markus / KCOM / Views / MainMenu.xaml.cs @ 45ac2822
이력 | 보기 | 이력해설 | 다운로드 (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 Svg2Xaml; |
16 |
using System; |
17 |
using System.Collections.Generic; |
18 |
using System.Diagnostics; |
19 |
using System.Linq; |
20 |
using System.Reflection; |
21 |
using System.Runtime.InteropServices; |
22 |
using System.Text; |
23 |
using System.Threading; |
24 |
using System.Threading.Tasks; |
25 |
using System.Web; |
26 |
using System.Windows; |
27 |
using System.Windows.Controls; |
28 |
using System.Windows.Ink; |
29 |
using System.Windows.Input; |
30 |
using System.Windows.Media; |
31 |
using System.Windows.Media.Imaging; |
32 |
using System.Windows.Shapes; |
33 |
using System.Windows.Threading; |
34 |
using Telerik.Windows.Controls; |
35 |
using Telerik.Windows.Data; |
36 |
using static KCOM.TempFile; |
37 |
|
38 |
namespace KCOM.Views |
39 |
{ |
40 |
public static class ControlExtensions |
41 |
{ |
42 |
public static T Clone<T>(this T controlToClone) |
43 |
where T : System.Windows.Controls.Control |
44 |
{ |
45 |
System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); |
46 |
|
47 |
T instance = Activator.CreateInstance<T>(); |
48 |
|
49 |
foreach (PropertyInfo propInfo in controlProperties) |
50 |
{ |
51 |
if (propInfo.CanWrite) |
52 |
{ |
53 |
if (propInfo.Name != "WindowTarget") |
54 |
propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null); |
55 |
} |
56 |
} |
57 |
return instance; |
58 |
} |
59 |
} |
60 |
|
61 |
public class MyConsole |
62 |
{ |
63 |
private readonly System.Threading.ManualResetEvent _readLineSignal; |
64 |
private string _lastLine; |
65 |
|
66 |
public MyConsole() |
67 |
{ |
68 |
_readLineSignal = new System.Threading.ManualResetEvent(false); |
69 |
Gui = new TextBox(); |
70 |
Gui.AcceptsReturn = true; |
71 |
Gui.KeyUp += OnKeyUp; |
72 |
} |
73 |
|
74 |
private void OnKeyUp(object sender, KeyEventArgs e) |
75 |
{ |
76 |
// this is always fired on UI thread |
77 |
if (e.Key == Key.Enter) |
78 |
{ |
79 |
// quick and dirty, but that is not relevant to your question |
80 |
_lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last(); |
81 |
// now, when you detected that user typed a line, set signal |
82 |
_readLineSignal.Set(); |
83 |
} |
84 |
} |
85 |
|
86 |
public TextBox Gui { get; private set; } |
87 |
|
88 |
public string ReadLine() |
89 |
{ |
90 |
// that should always be called from non-ui thread |
91 |
if (Gui.Dispatcher.CheckAccess()) |
92 |
throw new Exception("Cannot be called on UI thread"); |
93 |
// reset signal |
94 |
_readLineSignal.Reset(); |
95 |
// wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that |
96 |
_readLineSignal.WaitOne(); |
97 |
// we got signalled - return line user typed. |
98 |
return _lastLine; |
99 |
} |
100 |
|
101 |
public void WriteLine(string line) |
102 |
{ |
103 |
if (!Gui.Dispatcher.CheckAccess()) |
104 |
{ |
105 |
Gui.Dispatcher.Invoke(new Action(() => WriteLine(line))); |
106 |
return; |
107 |
} |
108 |
|
109 |
Gui.Text += line + Environment.NewLine; |
110 |
} |
111 |
} |
112 |
|
113 |
/// <summary> |
114 |
/// MainMenu.xaml에 대한 상호 작용 논리 |
115 |
/// </summary> |
116 |
public partial class MainMenu : UserControl |
117 |
{ |
118 |
#region 프로퍼티 |
119 |
|
120 |
private BitmapFrame tempPageImage =null; |
121 |
|
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 () { ViewerDataModel.Instance.DownloadFileProgress = (int)e.Progress; }); |
561 |
|
562 |
if (e.IsFinish) |
563 |
{ |
564 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.searchPanel_Instance.SetSerachPDFFile(instnaceFile); |
565 |
ViewerDataModel.Instance.IsDownloadOriginal = true; |
566 |
(sender as IIpc.WcfServer).IpcFileDownloadReceived -= WcfServer_IpcFileDownloadReceived; |
567 |
//(sender as IIpc.WcfServer).Stop(); |
568 |
} |
569 |
} |
570 |
catch (Exception ex) |
571 |
{ |
572 |
throw; |
573 |
} |
574 |
} |
575 |
|
576 |
private void timercallback(Object o) |
577 |
{ |
578 |
Stopwatch sw = new Stopwatch(); |
579 |
sw.Start(); |
580 |
TempFile.TempFileAdd(); |
581 |
sw.Stop(); |
582 |
|
583 |
Dispatcher.InvokeAsync(new Action(delegate |
584 |
{ |
585 |
if (this.ParentOfType<MainWindow>().dzTopMenu.cbAutoSave.IsChecked == true) //Auto Save Checked? |
586 |
{ |
587 |
timer.Change(((int)this.ParentOfType<MainWindow>().dzTopMenu.cbSaveInterval.Value * 60000) / 2, sw.ElapsedMilliseconds); //Timer Setting |
588 |
} |
589 |
})); |
590 |
|
591 |
////GC.Collect(); |
592 |
} |
593 |
|
594 |
/// <summary> |
595 |
/// update my markuplist |
596 |
/// - update existing markup data if already exist |
597 |
/// - add new markup data if control is new |
598 |
/// </summary> |
599 |
public void UpdateMyMarkupList() |
600 |
{ |
601 |
Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1); |
602 |
|
603 |
/// add or update markup list |
604 |
foreach (var control in ViewerDataModel.Instance.MarkupControls_USER) |
605 |
{ |
606 |
var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID); |
607 |
|
608 |
var exist = ViewerDataModel.Instance.MyMarkupList.Where(data => data.ID == root.CommentID).FirstOrDefault(); |
609 |
if (exist != null) //신규 추가 된 코멘트 |
610 |
{ |
611 |
if (exist.Data != root.ConvertData) //코멘트가 같은지 |
612 |
{ |
613 |
exist.Data = root.ConvertData; |
614 |
exist.IsUpdate = true; |
615 |
} |
616 |
} |
617 |
else if (root.CommentID != null) |
618 |
{ |
619 |
ViewerDataModel.Instance.MyMarkupList.Add(new MarkupItemEx |
620 |
{ |
621 |
ID = control.CommentID, |
622 |
Data = root.ConvertData, |
623 |
Data_Type = root.DATA_TYPE, |
624 |
MarkupInfoID = App.Custom_ViewInfoId, |
625 |
PageNumber = this.pageNavigator.CurrentPage.PageNumber, |
626 |
Symbol_ID = control.SymbolID, |
627 |
//Group_ID = control.GroupID, |
628 |
}); |
629 |
} |
630 |
} |
631 |
|
632 |
//if (this.pageNavigator.CurrentPage != null) |
633 |
//{ |
634 |
// /// delete markup list |
635 |
// int iPageNo = this.pageNavigator.CurrentPage.PageNumber; |
636 |
|
637 |
// var deleted = (from markup in ViewerDataModel.Instance.MyMarkupList |
638 |
// where (markup.PageNumber == iPageNo) |
639 |
// && (null == ViewerDataModel.Instance.MarkupControls_USER.Where(control => control.CommentID == markup.ID).FirstOrDefault()) |
640 |
// select markup).ToList(); |
641 |
|
642 |
// foreach (var markup in deleted) |
643 |
// { |
644 |
// ViewerDataModel.Instance.MyMarkupList.Remove(markup); |
645 |
// } |
646 |
//} |
647 |
//else |
648 |
//{ |
649 |
// System.Diagnostics.Debug.WriteLine("UpdateMyMarkupList : this.pageNavigator.CurrentPage null "); |
650 |
//} |
651 |
|
652 |
/// up to here |
653 |
|
654 |
//if (modified) |
655 |
//{ |
656 |
// if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null) |
657 |
// { |
658 |
// ComingNewBieEnd = true; |
659 |
// ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
660 |
// PreviewUserMarkupInfoItem.IsPreviewUser = false; |
661 |
// gridViewMarkup.ItemsSource = null; |
662 |
// gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
663 |
// gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem; |
664 |
|
665 |
// GroupDescriptor descriptor = new GroupDescriptor(); |
666 |
// descriptor.Member = "Depatment"; |
667 |
// descriptor.DisplayContent = "DEPT"; |
668 |
// descriptor.SortDirection = ListSortDirection.Ascending; |
669 |
// gridViewMarkup.GroupDescriptors.Add(descriptor); |
670 |
// } |
671 |
//} |
672 |
} |
673 |
|
674 |
/// <summary> |
675 |
/// start page changing |
676 |
/// - save controls if page is modified |
677 |
/// - starting download page image |
678 |
/// </summary> |
679 |
/// <param name="sender"></param> |
680 |
/// <param name="e"></param> |
681 |
private async void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e) |
682 |
{ |
683 |
System.Diagnostics.Debug.WriteLine("pageNavigator PageChanging"); |
684 |
// await PageLoadAsync(e.CurrentPage,e.PageNumber); |
685 |
//} |
686 |
|
687 |
//private async Task PageLoadAsync(DOCPAGE page, int PageNo) |
688 |
//{ |
689 |
DOCPAGE page = e.CurrentPage; |
690 |
int PageNo = e.PageNumber; |
691 |
|
692 |
ViewerDataModel.Instance.PageAngle = page.PAGE_ANGLE; |
693 |
|
694 |
// 페이지 이미지 변경 |
695 |
|
696 |
/// 컨트롤을 새로 생성한다. |
697 |
ViewerDataModel.Instance.ImageViewPath = tempPageImage; |
698 |
ViewerDataModel.Instance.ImageViewWidth = 1; |
699 |
ViewerDataModel.Instance.ImageViewHeight = 1; |
700 |
|
701 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Clear(); |
702 |
Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
703 |
Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
704 |
|
705 |
await PageChangingAsync(page, PageNo, ViewerDataModel.Instance.NewPagImageCancelToken()); |
706 |
|
707 |
await MarkupLoadAsync(PageNo, ViewerDataModel.Instance.PageAngle, ViewerDataModel.Instance.NewMarkupCancelToken()); |
708 |
|
709 |
//var pagechangeTask = PageChangingAsync(page, page.PAGE_NUMBER, ViewerDataModel.Instance.NewPagImageCancelToken()); |
710 |
|
711 |
//var markupLoadTask = MarkupLoadAsync(page.PAGE_NUMBER, ViewerDataModel.Instance.PageAngle, ViewerDataModel.Instance.NewMarkupCancelToken()); |
712 |
|
713 |
//await Task.WhenAll(pagechangeTask, markupLoadTask); |
714 |
} |
715 |
|
716 |
private async Task PageChangingAsync(DOCPAGE currentPage, int changePageNumber,CancellationToken token) |
717 |
{ |
718 |
var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? changePageNumber + ViewerDataModel.Instance.PageBalanceNumber : changePageNumber; |
719 |
|
720 |
#region 페이지가 벗어난 경우 |
721 |
|
722 |
if (BalancePoint < 1) |
723 |
{ |
724 |
BalancePoint = 1; |
725 |
ViewerDataModel.Instance.PageBalanceNumber = 0; |
726 |
} |
727 |
|
728 |
if (pageNavigator.PageCount < BalancePoint) |
729 |
{ |
730 |
BalancePoint = pageNavigator.PageCount; |
731 |
ViewerDataModel.Instance.PageBalanceNumber = 0; |
732 |
} |
733 |
|
734 |
#endregion 페이지가 벗어난 경우 |
735 |
|
736 |
ViewerDataModel.Instance.SyncPageNumber = BalancePoint; |
737 |
|
738 |
var pageWidth = Convert.ToDouble(currentPage.PAGE_WIDTH); |
739 |
var pageHeight = Convert.ToDouble(currentPage.PAGE_HEIGHT); |
740 |
var contentScale = zoomAndPanControl.ContentScale; |
741 |
|
742 |
#region 페이지 이미지 로딩 수정 |
743 |
|
744 |
|
745 |
ViewerDataModel.Instance.ImageViewPath = await App.PageStorage.GetPageImageAsync(token,changePageNumber); |
746 |
|
747 |
if(token.IsCancellationRequested) |
748 |
{ |
749 |
return; |
750 |
} |
751 |
|
752 |
ScaleImage(pageWidth, pageHeight); |
753 |
|
754 |
ViewerDataModel.Instance.ImageViewWidth = pageWidth; |
755 |
ViewerDataModel.Instance.ImageViewHeight = pageHeight; |
756 |
|
757 |
zoomAndPanCanvas.Width = pageWidth; |
758 |
zoomAndPanCanvas.Height = pageHeight; |
759 |
|
760 |
Common.ViewerDataModel.Instance.ContentWidth = pageWidth; |
761 |
Common.ViewerDataModel.Instance.ContentHeight = pageHeight; |
762 |
|
763 |
inkBoard.Width = pageWidth; |
764 |
inkBoard.Height = pageHeight; |
765 |
|
766 |
#endregion 페이지 이미지 로딩 수정 |
767 |
|
768 |
if (!testPanel2.IsHidden) |
769 |
{ |
770 |
Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1); |
771 |
//PDF모드일때 잠시 대기(강인구) |
772 |
if (IsSyncPDFMode) |
773 |
{ |
774 |
Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
775 |
var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber))); |
776 |
|
777 |
Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1); |
778 |
if (pdfpath.IsDownloading) |
779 |
{ |
780 |
pdfpath.DownloadCompleted += (ex, arg) => |
781 |
{ |
782 |
Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1); |
783 |
ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
784 |
ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
785 |
ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
786 |
zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
787 |
zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
788 |
}; |
789 |
} |
790 |
else |
791 |
{ |
792 |
Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1); |
793 |
ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
794 |
ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
795 |
ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
796 |
|
797 |
zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
798 |
zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
799 |
} |
800 |
} |
801 |
else |
802 |
{ |
803 |
Logger.sendCheckLog("Compare Image Download", 1); |
804 |
string compareImageUri = this.GetImageURL(CurrentRev.DOCUMENT_ID, BalancePoint); |
805 |
ComparePageLoad(compareImageUri,false); |
806 |
} |
807 |
|
808 |
tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint); |
809 |
} |
810 |
|
811 |
SearchFocusBorder.Visibility = Visibility.Collapsed; |
812 |
|
813 |
this.pageNavigator.ChangePage(changePageNumber); |
814 |
} |
815 |
|
816 |
private void ComparePageLoad(string pageUri, bool IsOriginalSize) |
817 |
{ |
818 |
/// 현재 보고 있는 VP와 같은 크기로 로딩 |
819 |
ViewerDataModel.Instance.ImageViewPath_C = null; |
820 |
|
821 |
if (IsOriginalSize && OriginalSizeMode.IsChecked) |
822 |
{ |
823 |
ViewerDataModel.Instance.ImageViewPath_C = ImageSourceHelper.GetDownloadImage(pageUri); |
824 |
} |
825 |
else |
826 |
{ |
827 |
var imageSize = new Size(ViewerDataModel.Instance.ImageViewWidth, ViewerDataModel.Instance.ImageViewHeight); |
828 |
ViewerDataModel.Instance.ImageViewPath_C = ImageSourceHelper.GetDownloadImage(pageUri, imageSize); |
829 |
} |
830 |
|
831 |
if (ViewerDataModel.Instance.ImageViewPath_C != null) |
832 |
{ |
833 |
ViewerDataModel.Instance.ImageViewWidth_C = ViewerDataModel.Instance.ImageViewPath_C.PixelWidth; |
834 |
ViewerDataModel.Instance.ImageViewHeight_C = ViewerDataModel.Instance.ImageViewPath_C.PixelHeight; |
835 |
zoomAndPanCanvas2.Width = ViewerDataModel.Instance.ImageViewPath_C.PixelWidth; |
836 |
zoomAndPanCanvas2.Height = ViewerDataModel.Instance.ImageViewPath_C.PixelHeight; |
837 |
|
838 |
zoomAndPanControl.ZoomTo(new Rect |
839 |
{ |
840 |
X = 0, |
841 |
Y = 0, |
842 |
Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
843 |
Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
844 |
}); |
845 |
|
846 |
if (Sync.IsChecked) |
847 |
{ |
848 |
Sync_Click(null, new RoutedEventArgs()); |
849 |
} |
850 |
|
851 |
if (CompareMode.IsChecked) |
852 |
{ |
853 |
SyncCompare_Click(null, new RoutedEventArgs()); |
854 |
} |
855 |
} |
856 |
} |
857 |
|
858 |
/// <summary> |
859 |
/// called after page is changed |
860 |
/// </summary> |
861 |
/// <param name="sender"></param> |
862 |
/// <param name="e"></param> |
863 |
private async void PageNavigator_PageChanged(object sender, Sample.PageChangeEventArgs e) |
864 |
{ |
865 |
//if (zoomAndPanCanvas.Width.IsNaN()) |
866 |
//{ |
867 |
//await zoomAndPanControl.Dispatcher.InvokeAsync(() => |
868 |
// zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height }) |
869 |
// ); |
870 |
//} |
871 |
|
872 |
var instanceMain = ViewerDataModel.Instance.SystemMain; |
873 |
|
874 |
instanceMain.dzMainMenu.CanvasDrawingMouseDownPoint = new Point(ViewerDataModel.Instance.ImageViewWidth / 2, ViewerDataModel.Instance.ImageViewHeight / 2); |
875 |
|
876 |
instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
877 |
instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
878 |
|
879 |
instanceMain.dzTopMenu.rotateOffSet = 0; |
880 |
var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault(); |
881 |
drawingPannelRotate(pageinfo.PAGE_ANGLE); |
882 |
|
883 |
/// 페이지의 모든 마크업을 로드한 후 호출 |
884 |
/// 좌측 마크업 list의 아이템을 클릭하는 경우 MarkupControls_USER가 0으로 나와서 추가함. |
885 |
ViewerDataModel.Instance.LoadPageMarkupFinish(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height }); |
886 |
|
887 |
//Point startPoint = new Point(15, 15); |
888 |
|
889 |
//var markupinfo = ViewerDataModel.Instance._markupInfoList.Where(x => x.UserID == App.ViewInfo.UserID).First(); |
890 |
|
891 |
////var rect = GetRectControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, startPoint); |
892 |
|
893 |
////var txtApproved = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, |
894 |
//// "APPROVED",30, FontWeights.Bold, TextAlignment.Center, rect.ItemRect, 15); |
895 |
|
896 |
////var txtCreator = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID |
897 |
//// , "By HYOSUNG", 18, FontWeights.Bold, TextAlignment.Center, rect.ItemRect, txtApproved.StartPoint.Y + txtApproved.BoxHeight + 3); |
898 |
|
899 |
//var symCtrl = GetSymNControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, startPoint); |
900 |
|
901 |
//var bottom = Rect.Offset(symCtrl.ItemRect, new Vector(0, symCtrl.ItemRect.Height)); |
902 |
|
903 |
//var txtOriginator = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID |
904 |
// , App.ViewInfo.UserID, 18, FontWeights.Bold, TextAlignment.Left, bottom, bottom.Top + 3); |
905 |
|
906 |
//var dtfi = new System.Globalization.DateTimeFormatInfo { DateSeparator = "-", ShortDatePattern = @"yyyy/MM/dd" }; |
907 |
|
908 |
//var txtDate = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID |
909 |
// , DateTime.Now.ToString("d", dtfi), 18, FontWeights.Bold, TextAlignment.Left, bottom, txtOriginator.StartPoint.Y + txtOriginator.BoxHeight + 2); |
910 |
|
911 |
//ViewerDataModel.Instance.MarkupControls_USER.Add(symCtrl); |
912 |
////ViewerDataModel.Instance.MarkupControls_USER.Add(txtApproved); |
913 |
////ViewerDataModel.Instance.MarkupControls_USER.Add(txtCreator); |
914 |
//ViewerDataModel.Instance.MarkupControls_USER.Add(txtOriginator); |
915 |
//ViewerDataModel.Instance.MarkupControls_USER.Add(txtDate); |
916 |
|
917 |
//symCtrl.ApplyTemplate(); |
918 |
////txtApproved.ApplyTemplate(); |
919 |
////txtCreator.ApplyTemplate(); |
920 |
//txtOriginator.ApplyTemplate(); |
921 |
//txtDate.ApplyTemplate(); |
922 |
|
923 |
////SetTextControl(txtApproved); |
924 |
////SetTextControl(txtCreator); |
925 |
//SetTextControl(txtOriginator); |
926 |
//SetTextControl(txtDate); |
927 |
|
928 |
//multi_Undo_Data = new Multi_Undo_data(); |
929 |
|
930 |
//MarkupToPDF.Common.Undo_data UndoData = new Undo_data() |
931 |
//{ |
932 |
// IsUndo = false, |
933 |
// Event = Event_Type.Create, |
934 |
// EventTime = DateTime.Now, |
935 |
// Markup_List = new List<Multi_Undo_data>() |
936 |
//}; |
937 |
|
938 |
//multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(symCtrl as MarkupToPDF.Common.CommentUserInfo); |
939 |
//UndoData.Markup_List.Add(multi_Undo_Data); |
940 |
|
941 |
////multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtApproved as MarkupToPDF.Common.CommentUserInfo); |
942 |
////UndoData.Markup_List.Add(multi_Undo_Data); |
943 |
|
944 |
////multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtCreator as MarkupToPDF.Common.CommentUserInfo); |
945 |
////UndoData.Markup_List.Add(multi_Undo_Data); |
946 |
|
947 |
//multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtOriginator as MarkupToPDF.Common.CommentUserInfo); |
948 |
//UndoData.Markup_List.Add(multi_Undo_Data); |
949 |
|
950 |
//multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtDate as MarkupToPDF.Common.CommentUserInfo); |
951 |
//UndoData.Markup_List.Add(multi_Undo_Data); |
952 |
|
953 |
//ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
954 |
|
955 |
//System.Diagnostics.Debug.WriteLine(symCtrl.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
956 |
////System.Diagnostics.Debug.WriteLine(txtApproved.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
957 |
////System.Diagnostics.Debug.WriteLine(txtCreator.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
958 |
//System.Diagnostics.Debug.WriteLine(txtOriginator.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
959 |
//System.Diagnostics.Debug.WriteLine(txtDate.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
960 |
} |
961 |
|
962 |
private void SetTextControl(TextControl textControl) |
963 |
{ |
964 |
textControl.Base_TextBlock.Margin = new Thickness(0, 0, 10, 0); |
965 |
textControl.Base_TextBox.Visibility = Visibility.Collapsed; |
966 |
textControl.Base_TextBlock.Visibility = Visibility.Visible; |
967 |
} |
968 |
|
969 |
private SymControlN GetSymNControl(double PageWidth, double PageHeight, string userId, string markupInfoId, Point startPosition) |
970 |
{ |
971 |
SymControlN result = null; |
972 |
|
973 |
try |
974 |
{ |
975 |
double height = 80; |
976 |
double itemWidth = 180; |
977 |
|
978 |
System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y); |
979 |
System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y + height); |
980 |
System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + height); |
981 |
System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y); |
982 |
|
983 |
result = new SymControlN |
984 |
{ |
985 |
CommentID = Commons.shortGuid(), |
986 |
MarkupInfoID = markupInfoId, |
987 |
UserID = userId, |
988 |
PointSet = new List<Point> { startPoint, leftBottomPoint, endPoint, topRightPoint }, |
989 |
StartPoint = startPoint, |
990 |
EndPoint = endPoint, |
991 |
CommentAngle = 0, |
992 |
LeftBottomPoint = leftBottomPoint, |
993 |
TopRightPoint = topRightPoint, |
994 |
Opacity = 1, |
995 |
PathXathData = "eJy1Ul1PwjAU/SvN9c3EdY5g1FAShyIxRgygxsemu7AbupZ0Vae/3g42/Azxxfuw9Z7Tnpx72t6lo4zdyAIFyHUBqwptSgG596tTzkuVYyHLqCDlbGnnPlK24C9k5hVP4viIV7LQfOWwROOlJ2ug36tVo1Sq5cLZJ5P1e1OrKRtYbV3qnsqcrZcC9oZNARuvpCL/KiCODoHxfo//EJmg8tIsNLKpd+hVLmBIWkPd2iU2cnGoFprlpJYGyzBOt8WuyeCVJSNgUstCM/1WHNgDZT5oJ3E4M0Ja5F7A8QmwgTTPIYlrnAfgIIm6W2hmVy3CN9M3GUzsyznOyVAdTBlG+NxvxffXx37nOlF3Fx3vppNd5P6nnL8bnWHlU23VktUrAWe3t5Px/cU5sKE1/qFRuKi8k6nV2Qae0ltIshPXncPNtX25lZF19BY2Sn2maWGK8GQEDMIXHbB7dJ7Ur1RrUcDmbXx3l76y0eN4endz+Qd/yX/663xk2v7eAQ==", |
996 |
Memo = null |
997 |
}; |
998 |
} |
999 |
catch (Exception ex) |
1000 |
{ |
1001 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
1002 |
} |
1003 |
|
1004 |
return result; |
1005 |
} |
1006 |
|
1007 |
private RectangleControl GetRectControl(double PageWidth, double PageHeight, string userId, string markupInfoId, Point startPosition) |
1008 |
{ |
1009 |
RectangleControl result = null; |
1010 |
|
1011 |
try |
1012 |
{ |
1013 |
double height = 80; |
1014 |
double itemWidth = 180; |
1015 |
|
1016 |
System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y); |
1017 |
System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y + height); |
1018 |
System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + height); |
1019 |
System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y); |
1020 |
|
1021 |
result = new RectangleControl |
1022 |
{ |
1023 |
CommentID = Commons.shortGuid(), |
1024 |
MarkupInfoID = markupInfoId, |
1025 |
LineSize = 5, |
1026 |
Paint = MarkupToPDF.Controls.Common.PaintSet.None, |
1027 |
StartPoint = startPoint, |
1028 |
EndPoint = endPoint, |
1029 |
CommentAngle = 0, |
1030 |
StrokeColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0x0, 0x0)), |
1031 |
//StrokeColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 64, 224, 208)), |
1032 |
FillColor = null, |
1033 |
DashSize = new System.Windows.Media.DoubleCollection(new[] { 999999.0 }), |
1034 |
Opacity = 1, |
1035 |
LeftBottomPoint = leftBottomPoint, |
1036 |
TopRightPoint = topRightPoint, |
1037 |
PointSet = new List<Point> { startPoint, leftBottomPoint, endPoint, topRightPoint }, |
1038 |
UserID = userId, |
1039 |
Memo = null |
1040 |
}; |
1041 |
} |
1042 |
catch (Exception ex) |
1043 |
{ |
1044 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
1045 |
} |
1046 |
|
1047 |
return result; |
1048 |
} |
1049 |
|
1050 |
private TextControl GetTextControl(double PageWidth, double PageHeight, string userId, string markupInfoId, string Text, double fontSize, FontWeight fontWeight, TextAlignment textAlignment, Rect parentRect, double positionY) |
1051 |
{ |
1052 |
TextControl result = null; |
1053 |
|
1054 |
try |
1055 |
{ |
1056 |
var txtSize = ShapeMeasure(new TextBlock { Text = Text, FontSize = fontSize, FontWeight = fontWeight, FontFamily = new FontFamily("Tahoma") }); |
1057 |
|
1058 |
double startPositionX = parentRect.X; |
1059 |
|
1060 |
switch (textAlignment) |
1061 |
{ |
1062 |
case TextAlignment.Right: |
1063 |
startPositionX = parentRect.X + parentRect.Width - txtSize.Width; |
1064 |
break; |
1065 |
|
1066 |
case TextAlignment.Center: |
1067 |
startPositionX = parentRect.X + parentRect.Width / 2 - txtSize.Width / 2 - 3; |
1068 |
break; |
1069 |
} |
1070 |
|
1071 |
Point startPosition = new Point |
1072 |
{ |
1073 |
X = startPositionX, |
1074 |
Y = positionY |
1075 |
}; |
1076 |
|
1077 |
System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y); |
1078 |
System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + txtSize.Width, startPosition.Y + txtSize.Height); |
1079 |
System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + txtSize.Height); |
1080 |
System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + txtSize.Width, startPosition.Y); |
1081 |
|
1082 |
result = new TextControl |
1083 |
{ |
1084 |
CommentID = Commons.shortGuid(), |
1085 |
MarkupInfoID = markupInfoId, |
1086 |
Text = Text, |
1087 |
StartPoint = startPoint, |
1088 |
EndPoint = endPoint, |
1089 |
CanvasX = startPosition.X, |
1090 |
CanvasY = startPosition.Y, |
1091 |
BoxWidth = txtSize.Width, |
1092 |
BoxHeight = txtSize.Height, |
1093 |
ControlType_No = 0, |
1094 |
LineSize = new Thickness(5), |
1095 |
TextSize = fontSize, |
1096 |
Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0, 0)), |
1097 |
FontSize = 10, |
1098 |
UserID = userId, |
1099 |
IsHighLight = false, |
1100 |
CommentAngle = 0, |
1101 |
PointSet = new List<Point>(), |
1102 |
Opacity = 1, |
1103 |
IsSelected = false, |
1104 |
TextFamily = new FontFamily("Tahoma"), |
1105 |
TextStyle = FontStyles.Normal, |
1106 |
TextWeight = FontWeights.Bold |
1107 |
}; |
1108 |
} |
1109 |
catch (Exception ex) |
1110 |
{ |
1111 |
} |
1112 |
|
1113 |
return result; |
1114 |
} |
1115 |
|
1116 |
public static Size ShapeMeasure(UIElement e) |
1117 |
{ |
1118 |
// Measured Size is bounded to be less than maxSize |
1119 |
Size maxSize = new Size( |
1120 |
double.PositiveInfinity, |
1121 |
double.PositiveInfinity); |
1122 |
e.Measure(maxSize); |
1123 |
return e.DesiredSize; |
1124 |
} |
1125 |
|
1126 |
private async Task MarkupLoadAsync(int pageNumber,Double PageAngle, CancellationToken cts) |
1127 |
{ |
1128 |
System.Diagnostics.Stopwatch stopwatch = new Stopwatch(); |
1129 |
stopwatch.Start(); |
1130 |
|
1131 |
/// 컨트롤을 새로 생성한다. |
1132 |
Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
1133 |
Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
1134 |
|
1135 |
System.Diagnostics.Debug.WriteLine("MarkupLoad - Clear " + new TimeSpan(stopwatch.ElapsedTicks).ToString()); |
1136 |
|
1137 |
foreach (var markup in ViewerDataModel.Instance.MyMarkupList.Where(param => param.PageNumber == pageNumber)) |
1138 |
{ |
1139 |
if (cts.IsCancellationRequested) |
1140 |
{ |
1141 |
return; |
1142 |
} |
1143 |
|
1144 |
var info = ViewerDataModel.Instance._markupInfoList.Where(param => param.MarkupInfoID == markup.MarkupInfoID).FirstOrDefault(); |
1145 |
if (info != null) |
1146 |
{ |
1147 |
string sColor = (info.UserID == App.ViewInfo.UserID) ? "#FFFF0000" : info.DisplayColor; |
1148 |
if (info.UserID == App.ViewInfo.UserID) |
1149 |
{ |
1150 |
var control = await MarkupParser.ParseExAsync(App.BaseAddress, cts, App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, PageAngle, sColor, "", |
1151 |
markup.MarkupInfoID, markup.ID); |
1152 |
control.Visibility = Visibility.Hidden; |
1153 |
} |
1154 |
else |
1155 |
{ |
1156 |
var control = await MarkupParser.ParseExAsync(App.BaseAddress, cts, App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, PageAngle, sColor, "", |
1157 |
markup.MarkupInfoID, markup.ID); |
1158 |
control.Visibility = Visibility.Hidden; |
1159 |
} |
1160 |
} |
1161 |
}; |
1162 |
/// up to here |
1163 |
|
1164 |
System.Diagnostics.Debug.WriteLine("MarkupLoad - MarkupParser " + new TimeSpan(stopwatch.ElapsedTicks).ToString()); |
1165 |
|
1166 |
/// fire selection event |
1167 |
List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
1168 |
this.gridViewMarkup.UnselectAll(); |
1169 |
this.gridViewMarkup.Select(gridSelectionItem); |
1170 |
|
1171 |
if (!testPanel2.IsHidden) |
1172 |
{ |
1173 |
ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
1174 |
ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
1175 |
ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
1176 |
|
1177 |
Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
1178 |
List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
1179 |
|
1180 |
foreach (var item in gridSelectionRevItem) |
1181 |
{ |
1182 |
var markupitems = item.MarkupList.Where(pageItem => pageItem.PageNumber == pageNumber).ToList(); |
1183 |
|
1184 |
foreach (var markupitem in markupitems) |
1185 |
{ |
1186 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync,PageAngle, item.DisplayColor, "", item.MarkupInfoID); |
1187 |
|
1188 |
if (cts.IsCancellationRequested) |
1189 |
{ |
1190 |
return; |
1191 |
} |
1192 |
} |
1193 |
} |
1194 |
} |
1195 |
|
1196 |
SetCommentPages(cts); |
1197 |
} |
1198 |
|
1199 |
public void SetCommentPages(CancellationToken? cts) |
1200 |
{ |
1201 |
Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1); |
1202 |
List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>(); |
1203 |
foreach (var item in ViewerDataModel.Instance._markupInfoList) |
1204 |
{ |
1205 |
//Comment 가 존재할 경우에만 Thumbnail 에 추가 |
1206 |
if (item.MarkupList != null) |
1207 |
{ |
1208 |
UsersCommentPagesMember instance = new UsersCommentPagesMember(); |
1209 |
instance.UserName = item.UserName; |
1210 |
instance.Depart = item.Depatment; |
1211 |
instance.MarkupInfoID = item.MarkupInfoID; |
1212 |
instance.IsSelected = true; |
1213 |
instance.isConSolidation = item.Consolidate; |
1214 |
instance.SetColor = item.DisplayColor; |
1215 |
if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID) |
1216 |
{ |
1217 |
instance.PageNumber = ViewerDataModel.Instance.MyMarkupList.Select(d => d.PageNumber).ToList(); |
1218 |
} |
1219 |
else |
1220 |
{ |
1221 |
instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList(); |
1222 |
} |
1223 |
_pages.Add(instance); |
1224 |
} |
1225 |
|
1226 |
if (cts != null) |
1227 |
{ |
1228 |
if (cts.Value.IsCancellationRequested) |
1229 |
return; |
1230 |
} |
1231 |
} |
1232 |
|
1233 |
this.pageNavigator.SetCommentList(_pages.ToList(),cts); |
1234 |
} |
1235 |
|
1236 |
public void MarkupitemViewUpdate(string markupinfo_id) |
1237 |
{ |
1238 |
//db에 업데이트 한 list 를 view 에 업데이트 |
1239 |
string sDocID = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocInfo.ID; |
1240 |
List<MarkupInfoItem> results = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, sDocID); |
1241 |
MarkupInfoItem dbinfo = results.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault(); |
1242 |
MarkupInfoItem viewinfo = Common.ViewerDataModel.Instance._markupInfoList.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault(); |
1243 |
if (dbinfo.MarkupList.Count > 0) |
1244 |
{ |
1245 |
if (viewinfo.MarkupList != null) |
1246 |
{ |
1247 |
viewinfo.MarkupList.Clear(); |
1248 |
viewinfo.MarkupList = null; |
1249 |
} |
1250 |
|
1251 |
viewinfo.MarkupList = new List<MarkupItem>(); |
1252 |
foreach (var item in dbinfo.MarkupList) |
1253 |
{ |
1254 |
System.Diagnostics.Debug.WriteLine(item.ID); |
1255 |
viewinfo.MarkupList.Add(item); |
1256 |
} |
1257 |
} |
1258 |
} |
1259 |
|
1260 |
private async void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e) |
1261 |
{ |
1262 |
var instance = ViewerDataModel.Instance; |
1263 |
|
1264 |
if (instance.IsWheelPageChanage) |
1265 |
{ |
1266 |
return; |
1267 |
} |
1268 |
|
1269 |
if (instance.IsPressCtrl) // && !instance.IsWheelPageChanage) |
1270 |
{ |
1271 |
int changePage = 0; |
1272 |
|
1273 |
if (e.Delta > 0) |
1274 |
{ |
1275 |
if (0 < instance.ContentOffsetY) |
1276 |
{ |
1277 |
Vector dragOffset = new Vector(0, e.Delta); |
1278 |
MoveZoomAndPanControl(dragOffset); |
1279 |
} |
1280 |
//else |
1281 |
//{ |
1282 |
// if (instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber > 1) |
1283 |
// { |
1284 |
// instance.IsWheelPageChanage = true; |
1285 |
// changePage -= 1; |
1286 |
// } |
1287 |
//} |
1288 |
} |
1289 |
else if (e.Delta < 0) |
1290 |
{ |
1291 |
if (instance.ContentHeight > instance.ContentOffsetY + instance.ContentViewportHeight) |
1292 |
{ |
1293 |
Vector dragOffset = new Vector(0, e.Delta); |
1294 |
MoveZoomAndPanControl(dragOffset); |
1295 |
} |
1296 |
//else |
1297 |
//{ |
1298 |
// if (instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber < instance.SystemMain.dzMainMenu.pageNavigator.PageCount) |
1299 |
// { |
1300 |
// instance.IsWheelPageChanage = true; |
1301 |
// changePage += 1; |
1302 |
// } |
1303 |
//} |
1304 |
} |
1305 |
|
1306 |
//if (changePage != 0) |
1307 |
//{ |
1308 |
// await Task.Factory.StartNew(() => |
1309 |
// { |
1310 |
// double beforeScale = instance.ContentScale; |
1311 |
|
1312 |
// EventHandler<Sample.PageChangeEventArgs> handler = null; |
1313 |
|
1314 |
// handler = (snd, evt) => |
1315 |
// { |
1316 |
// /// 최상단으로 이전 zoomScale로 위치한다 |
1317 |
// //Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
1318 |
// //zoomAndPanControl.ZoomAboutPoint(beforeScale, new Point(currentContentMousePoint.X, 0)); |
1319 |
// instance.IsWheelPageChanage = false; |
1320 |
// pageNavigator.PageChanged -= handler; |
1321 |
// }; |
1322 |
|
1323 |
// pageNavigator.PageChanged += handler; |
1324 |
|
1325 |
// pageNavigator.GotoPage(Convert.ToInt32(instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + changePage); |
1326 |
// }); |
1327 |
|
1328 |
//} |
1329 |
} |
1330 |
else |
1331 |
{ |
1332 |
e.Handled = true; |
1333 |
if (e.Delta > 0) |
1334 |
{ |
1335 |
Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
1336 |
ZoomIn(currentContentMousePoint); |
1337 |
} |
1338 |
else |
1339 |
{ |
1340 |
Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
1341 |
ZoomOut(currentContentMousePoint); |
1342 |
} |
1343 |
} |
1344 |
} |
1345 |
|
1346 |
private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e) |
1347 |
{ |
1348 |
e.Handled = true; |
1349 |
if (e.Delta > 0) |
1350 |
{ |
1351 |
Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
1352 |
ZoomIn_Sync(currentContentMousePoint); |
1353 |
} |
1354 |
else |
1355 |
{ |
1356 |
Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
1357 |
ZoomOut_Sync(currentContentMousePoint); |
1358 |
} |
1359 |
} |
1360 |
|
1361 |
#region ZoomIn & ZoomOut |
1362 |
|
1363 |
private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e) |
1364 |
{ |
1365 |
ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX, |
1366 |
zoomAndPanControl.ContentZoomFocusY)); |
1367 |
} |
1368 |
|
1369 |
private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e) |
1370 |
{ |
1371 |
ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX, |
1372 |
zoomAndPanControl.ContentZoomFocusY)); |
1373 |
} |
1374 |
|
1375 |
//강인구 추가 (줌 인아웃 수치 변경) |
1376 |
//큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼 |
1377 |
private void ZoomOut(Point contentZoomCenter) |
1378 |
{ |
1379 |
if (zoomAndPanControl.ContentScale > 0.39) |
1380 |
{ |
1381 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter); |
1382 |
} |
1383 |
else |
1384 |
{ |
1385 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter); |
1386 |
} |
1387 |
|
1388 |
if (zoomAndPanControl2 != null && Sync.IsChecked) |
1389 |
{ |
1390 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
1391 |
} |
1392 |
} |
1393 |
|
1394 |
private void ZoomIn(Point contentZoomCenter) |
1395 |
{ |
1396 |
if (zoomAndPanControl.ContentScale > 0.19) |
1397 |
{ |
1398 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter); |
1399 |
} |
1400 |
else |
1401 |
{ |
1402 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter); |
1403 |
} |
1404 |
|
1405 |
if (zoomAndPanControl2 != null && Sync.IsChecked) |
1406 |
{ |
1407 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
1408 |
} |
1409 |
} |
1410 |
|
1411 |
private void ZoomOut_Sync(Point contentZoomCenter) |
1412 |
{ |
1413 |
if (zoomAndPanControl2.ContentScale > 0.39) |
1414 |
{ |
1415 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter); |
1416 |
} |
1417 |
else |
1418 |
{ |
1419 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter); |
1420 |
} |
1421 |
|
1422 |
if (Sync.IsChecked) |
1423 |
{ |
1424 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
1425 |
} |
1426 |
} |
1427 |
|
1428 |
private void ZoomIn_Sync(Point contentZoomCenter) |
1429 |
{ |
1430 |
if (zoomAndPanControl2.ContentScale > 0.19) |
1431 |
{ |
1432 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter); |
1433 |
} |
1434 |
else |
1435 |
{ |
1436 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter); |
1437 |
} |
1438 |
|
1439 |
if (Sync.IsChecked) |
1440 |
{ |
1441 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
1442 |
} |
1443 |
} |
1444 |
|
1445 |
private void ZoomOut() |
1446 |
{ |
1447 |
zoomAndPanControl.ContentScale -= 0.1; |
1448 |
//if (zoomAndPanControl2 != null) |
1449 |
//{ |
1450 |
// zoomAndPanControl2.ContentScale -= 0.1; |
1451 |
//} |
1452 |
} |
1453 |
|
1454 |
private void ZoomIn() |
1455 |
{ |
1456 |
zoomAndPanControl.ContentScale += 0.1; |
1457 |
//if (zoomAndPanControl2 != null) |
1458 |
//{ |
1459 |
// zoomAndPanControl2.ContentScale += 0.1; |
1460 |
//} |
1461 |
} |
1462 |
|
1463 |
#endregion ZoomIn & ZoomOut |
1464 |
|
1465 |
private void init() |
1466 |
{ |
1467 |
foreach (var item in ViewerDataModel.Instance.MarkupControls) |
1468 |
{ |
1469 |
ControlList.Clear(); |
1470 |
listBox.Items.Clear(); |
1471 |
selected_item.Clear(); |
1472 |
|
1473 |
(item as IMarkupCommonData).IsSelected = false; |
1474 |
} |
1475 |
} |
1476 |
|
1477 |
private HitTestResultBehavior MyCallback(HitTestResult result) |
1478 |
{ |
1479 |
//this.cursor = Cursors.UpArrow; |
1480 |
var element = result.VisualHit; |
1481 |
while (element != null && !(element is CommentUserInfo)) |
1482 |
element = VisualTreeHelper.GetParent(element); |
1483 |
|
1484 |
if (element == null) |
1485 |
{ |
1486 |
return HitTestResultBehavior.Stop; |
1487 |
} |
1488 |
else |
1489 |
{ |
1490 |
if (element is CommentUserInfo) |
1491 |
{ |
1492 |
if (!hitList.Contains(element)) |
1493 |
{ |
1494 |
hitList.Add((CommentUserInfo)element); |
1495 |
} |
1496 |
else |
1497 |
{ |
1498 |
return HitTestResultBehavior.Stop; |
1499 |
} |
1500 |
} |
1501 |
} |
1502 |
return HitTestResultBehavior.Continue; |
1503 |
} |
1504 |
|
1505 |
public void ReleaseSelectPath() |
1506 |
{ |
1507 |
if (SelectionPath == null) |
1508 |
{ |
1509 |
SelectionPath = new Path(); |
1510 |
SelectionPath.Name = ""; |
1511 |
} |
1512 |
if (SelectionPath.Name != "") |
1513 |
{ |
1514 |
SelectionPath.Name = "None"; |
1515 |
} |
1516 |
SelectionPath.Opacity = 0.01; |
1517 |
SelectionPath.RenderTransform = null; |
1518 |
SelectionPath.RenderTransformOrigin = new Point(0, 0); |
1519 |
} |
1520 |
|
1521 |
#region 컨트롤 초기화 |
1522 |
|
1523 |
public void Control_Init(object control) |
1524 |
{ |
1525 |
if (L_Size != 0 && (control as IPath) != null) |
1526 |
{ |
1527 |
(control as IPath).LineSize = L_Size; |
1528 |
L_Size = 0; |
1529 |
} |
1530 |
|
1531 |
switch (control.GetType().Name) |
1532 |
{ |
1533 |
case "RectangleControl": |
1534 |
{ |
1535 |
(control as RectangleControl).StrokeColor = Brushes.Red; |
1536 |
} |
1537 |
break; |
1538 |
|
1539 |
case "CircleControl": |
1540 |
{ |
1541 |
(control as CircleControl).StrokeColor = Brushes.Red; |
1542 |
} |
1543 |
break; |
1544 |
|
1545 |
case "TriControl": |
1546 |
{ |
1547 |
(control as TriControl).StrokeColor = Brushes.Red; |
1548 |
} |
1549 |
break; |
1550 |
|
1551 |
case "RectCloudControl": |
1552 |
{ |
1553 |
(control as RectCloudControl).StrokeColor = Brushes.Red; |
1554 |
} |
1555 |
break; |
1556 |
|
1557 |
case "CloudControl": |
1558 |
{ |
1559 |
(control as CloudControl).StrokeColor = Brushes.Red; |
1560 |
} |
1561 |
break; |
1562 |
|
1563 |
case "PolygonControl": |
1564 |
{ |
1565 |
(control as PolygonControl).StrokeColor = Brushes.Red; |
1566 |
} |
1567 |
break; |
1568 |
|
1569 |
case "ArcControl": |
1570 |
{ |
1571 |
(control as ArcControl).StrokeColor = Brushes.Red; |
1572 |
} |
1573 |
break; |
1574 |
|
1575 |
case "ArrowArcControl": |
1576 |
{ |
1577 |
(control as ArrowArcControl).StrokeColor = Brushes.Red; |
1578 |
} |
1579 |
break; |
1580 |
|
1581 |
case "LineControl": |
1582 |
{ |
1583 |
(control as LineControl).StrokeColor = Brushes.Red; |
1584 |
} |
1585 |
break; |
1586 |
|
1587 |
case "ArrowControl_Multi": |
1588 |
{ |
1589 |
(control as ArrowControl_Multi).StrokeColor = Brushes.Red; |
1590 |
} |
1591 |
break; |
1592 |
|
1593 |
case "TextControl": |
1594 |
{ |
1595 |
(control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
1596 |
} |
1597 |
break; |
1598 |
|
1599 |
case "ArrowTextControl": |
1600 |
{ |
1601 |
(control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
1602 |
} |
1603 |
break; |
1604 |
|
1605 |
case "InsideWhiteControl": |
1606 |
{ |
1607 |
(control as InsideWhiteControl).StrokeColor = Brushes.White; |
1608 |
} |
1609 |
break; |
1610 |
|
1611 |
case "OverlapWhiteControl": |
1612 |
{ |
1613 |
(control as OverlapWhiteControl).StrokeColor = Brushes.White; |
1614 |
} |
1615 |
break; |
1616 |
|
1617 |
case "ClipWhiteControl": |
1618 |
{ |
1619 |
(control as ClipWhiteControl).StrokeColor = Brushes.White; |
1620 |
} |
1621 |
break; |
1622 |
|
1623 |
case "CoordinateControl": |
1624 |
{ |
1625 |
(control as CoordinateControl).StrokeColor = Brushes.Black; |
1626 |
} |
1627 |
break; |
1628 |
} |
1629 |
} |
1630 |
|
1631 |
#endregion 컨트롤 초기화 |
1632 |
|
1633 |
public void firstCondition_MouseLeave(object sender, MouseEventArgs e) |
1634 |
{ |
1635 |
//Control_Init(e.Source); |
1636 |
} |
1637 |
|
1638 |
//private Window _dragdropWindow = null; |
1639 |
|
1640 |
[DllImport("user32.dll")] |
1641 |
[return: MarshalAs(UnmanagedType.Bool)] |
1642 |
internal static extern bool GetCursorPos(ref Win32Point pt); |
1643 |
|
1644 |
[StructLayout(LayoutKind.Sequential)] |
1645 |
internal struct Win32Point |
1646 |
{ |
1647 |
public Int32 X; |
1648 |
public Int32 Y; |
1649 |
}; |
1650 |
|
1651 |
/* |
1652 |
public string symbol_id = null; |
1653 |
public long symbol_group_id; |
1654 |
public int symbol_SelectedIndex; |
1655 |
public ImageSource symbol_img; |
1656 |
public string symbol_Data = null; |
1657 |
public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img) |
1658 |
{ |
1659 |
PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, new Point(zoomAndPanCanvas.ActualWidth / 2, |
1660 |
zoomAndPanCanvas.ActualHeight / 2)); |
1661 |
|
1662 |
if (this._dragdropWindow != null) |
1663 |
{ |
1664 |
this._dragdropWindow.Close(); |
1665 |
this._dragdropWindow = null; |
1666 |
} |
1667 |
|
1668 |
symbol_id = id; |
1669 |
symbol_group_id = group_id; |
1670 |
symbol_SelectedIndex = SelectedIndex; |
1671 |
symbol_Data = Data_; |
1672 |
symbol_img = img; |
1673 |
|
1674 |
CreateDragDropWindow2(img); |
1675 |
} |
1676 |
|
1677 |
private void CreateDragDropWindow2(ImageSource image) |
1678 |
{ |
1679 |
this._dragdropWindow = new Window(); |
1680 |
_dragdropWindow.Cursor = new Cursor(App.DefaultArrowCursorStream); |
1681 |
_dragdropWindow.WindowStyle = WindowStyle.None; |
1682 |
_dragdropWindow.AllowsTransparency = true; |
1683 |
_dragdropWindow.AllowDrop = false; |
1684 |
_dragdropWindow.Background = null; |
1685 |
_dragdropWindow.IsHitTestVisible = false; |
1686 |
_dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight; |
1687 |
_dragdropWindow.Topmost = true; |
1688 |
_dragdropWindow.ShowInTaskbar = false; |
1689 |
|
1690 |
Rectangle r = new Rectangle(); |
1691 |
r.Width = image.Width; |
1692 |
r.Height = image.Height; |
1693 |
r.Opacity = 0.5; |
1694 |
r.Fill = new ImageBrush(image); |
1695 |
this._dragdropWindow.Content = r; |
1696 |
|
1697 |
Win32Point w32Mouse = new Win32Point(); |
1698 |
GetCursorPos(ref w32Mouse); |
1699 |
|
1700 |
//w32Mouse.X = getCurrentPoint.X; |
1701 |
this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2); |
1702 |
this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2); |
1703 |
this._dragdropWindow.Show(); |
1704 |
} |
1705 |
|
1706 |
*/ |
1707 |
|
1708 |
public void MoveZoomAndPanControl(Vector dragOffset) |
1709 |
{ |
1710 |
zoomAndPanControl.ContentOffsetX -= dragOffset.X; |
1711 |
zoomAndPanControl.ContentOffsetY -= dragOffset.Y; |
1712 |
|
1713 |
if (Sync.IsChecked) |
1714 |
{ |
1715 |
ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
1716 |
ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
1717 |
} |
1718 |
} |
1719 |
|
1720 |
private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e) |
1721 |
{ |
1722 |
if (Common.ViewerDataModel.Instance.SelectedControl == "Batch" |
1723 |
|| Common.ViewerDataModel.Instance.SelectedControl == "MACRO") |
1724 |
//if(this.txtBatch.Visibility == Visibility.Visible) |
1725 |
{ |
1726 |
if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; } |
1727 |
|
1728 |
Point currentPos = e.GetPosition(rect); |
1729 |
|
1730 |
floatingTip.HorizontalOffset = currentPos.X + 20; |
1731 |
floatingTip.VerticalOffset = currentPos.Y; |
1732 |
} |
1733 |
|
1734 |
getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
1735 |
|
1736 |
if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed)) |
1737 |
{ |
1738 |
SetCursor(); |
1739 |
Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
1740 |
Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
1741 |
|
1742 |
Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
1743 |
|
1744 |
MoveZoomAndPanControl(dragOffset); |
1745 |
} |
1746 |
|
1747 |
if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null) |
1748 |
{ |
1749 |
Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
1750 |
Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
1751 |
SetCursor(); |
1752 |
|
1753 |
if (currentControl != null) |
1754 |
{ |
1755 |
double moveX = currentCanvasDrawingMouseMovePoint.X - CanvasDrawingMouseDownPoint.X; |
1756 |
double moveY = currentCanvasDrawingMouseMovePoint.Y - CanvasDrawingMouseDownPoint.Y; |
1757 |
//강인구 추가 |
1758 |
currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity; |
1759 |
|
1760 |
if ((currentControl as IPath) != null) |
1761 |
{ |
1762 |
(currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize; |
1763 |
} |
1764 |
if ((currentControl as LineControl) != null) |
1765 |
{ |
1766 |
(currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval; |
1767 |
} |
1768 |
|
1769 |
if ((currentControl as IShapeControl) != null) |
1770 |
{ |
1771 |
(currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet; |
1772 |
} |
1773 |
if ((currentControl as TextControl) != null) |
1774 |
{ |
1775 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
1776 |
{ |
1777 |
(currentControl as TextControl).TextStyle = FontStyles.Italic; |
1778 |
} |
1779 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
1780 |
{ |
1781 |
(currentControl as TextControl).TextWeight = FontWeights.Bold; |
1782 |
} |
1783 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
1784 |
{ |
1785 |
(currentControl as TextControl).UnderLine = TextDecorations.Underline; |
1786 |
} |
1787 |
} |
1788 |
else if ((currentControl as ArrowTextControl) != null) |
1789 |
{ |
1790 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
1791 |
{ |
1792 |
(currentControl as ArrowTextControl).TextStyle = FontStyles.Italic; |
1793 |
} |
1794 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
1795 |
{ |
1796 |
(currentControl as ArrowTextControl).TextWeight = FontWeights.Bold; |
1797 |
} |
1798 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
1799 |
{ |
1800 |
(currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline; |
1801 |
} |
1802 |
} |
1803 |
else if ((currentControl as RectCloudControl) != null) |
1804 |
{ |
1805 |
(currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
1806 |
} |
1807 |
else if ((currentControl as CloudControl) != null) |
1808 |
{ |
1809 |
(currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
1810 |
} |
1811 |
|
1812 |
#region // 모든 컨트롤의 공통기능 제어 |
1813 |
|
1814 |
if (controlType != ControlType.PenControl) |
1815 |
{ |
1816 |
currentControl.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift); |
1817 |
ViewerDataModel.Instance.IsMarkupUpdate = true; |
1818 |
} |
1819 |
|
1820 |
#endregion // 모든 컨트롤의 공통기능 제어 |
1821 |
|
1822 |
#region // 각 컨트롤의 특별한 기능을 제어한다. |
1823 |
|
1824 |
switch (controlType) |
1825 |
{ |
1826 |
case (ControlType.Coordinate): |
1827 |
{ |
1828 |
var control = currentControl as CoordinateControl; |
1829 |
if (control != null) |
1830 |
{ |
1831 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1832 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1833 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1834 |
} |
1835 |
} |
1836 |
break; |
1837 |
|
1838 |
case (ControlType.InsideWhite): |
1839 |
{ |
1840 |
var control = currentControl as InsideWhiteControl; |
1841 |
if (control != null) |
1842 |
{ |
1843 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1844 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1845 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1846 |
control.Paint = PaintSet.Fill; |
1847 |
} |
1848 |
} |
1849 |
break; |
1850 |
|
1851 |
case ControlType.OverlapWhite: |
1852 |
{ |
1853 |
var control = currentControl as OverlapWhiteControl; |
1854 |
if (control != null) |
1855 |
{ |
1856 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1857 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1858 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1859 |
control.Paint = PaintSet.Fill; |
1860 |
} |
1861 |
} |
1862 |
break; |
1863 |
|
1864 |
case ControlType.ClipWhite: |
1865 |
{ |
1866 |
var control = currentControl as ClipWhiteControl; |
1867 |
if (control != null) |
1868 |
{ |
1869 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1870 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1871 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1872 |
control.Paint = PaintSet.Fill; |
1873 |
} |
1874 |
} |
1875 |
break; |
1876 |
|
1877 |
case ControlType.RectCloud: |
1878 |
{ |
1879 |
var control = currentControl as RectCloudControl; |
1880 |
if (control != null) |
1881 |
{ |
1882 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1883 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1884 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1885 |
} |
1886 |
} |
1887 |
break; |
1888 |
|
1889 |
case ControlType.SingleLine: |
1890 |
case ControlType.CancelLine: |
1891 |
case ControlType.ArrowLine: |
1892 |
case ControlType.TwinLine: |
1893 |
case ControlType.DimLine: |
1894 |
{ |
1895 |
var control = currentControl as LineControl; |
1896 |
if (control != null) |
1897 |
{ |
1898 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1899 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1900 |
} |
1901 |
} |
1902 |
break; |
1903 |
|
1904 |
case ControlType.ArcLine: |
1905 |
{ |
1906 |
var control = currentControl as ArcControl; |
1907 |
if (control != null) |
1908 |
{ |
1909 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1910 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1911 |
} |
1912 |
} |
1913 |
break; |
1914 |
|
1915 |
case ControlType.ArcArrow: |
1916 |
{ |
1917 |
var control = currentControl as ArrowArcControl; |
1918 |
if (control != null) |
1919 |
{ |
1920 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1921 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1922 |
} |
1923 |
} |
1924 |
break; |
1925 |
|
1926 |
case ControlType.ArrowMultiLine: |
1927 |
{ |
1928 |
var control = currentControl as ArrowControl_Multi; |
1929 |
if (control != null) |
1930 |
{ |
1931 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1932 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1933 |
} |
1934 |
} |
1935 |
break; |
1936 |
|
1937 |
case ControlType.Circle: |
1938 |
{ |
1939 |
var control = currentControl as CircleControl; |
1940 |
|
1941 |
if (control != null) |
1942 |
{ |
1943 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1944 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1945 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1946 |
} |
1947 |
} |
1948 |
break; |
1949 |
|
1950 |
case ControlType.PolygonCloud: |
1951 |
{ |
1952 |
var control = currentControl as CloudControl; |
1953 |
if (control != null) |
1954 |
{ |
1955 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1956 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1957 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1958 |
} |
1959 |
} |
1960 |
break; |
1961 |
|
1962 |
case ControlType.Triangle: |
1963 |
{ |
1964 |
var control = currentControl as TriControl; |
1965 |
if (control != null) |
1966 |
{ |
1967 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1968 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1969 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1970 |
} |
1971 |
} |
1972 |
break; |
1973 |
|
1974 |
case ControlType.ImgControl: |
1975 |
{ |
1976 |
var control = currentControl as ImgControl; |
1977 |
if (control != null) |
1978 |
{ |
1979 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1980 |
} |
1981 |
} |
1982 |
break; |
1983 |
|
1984 |
case ControlType.Date: |
1985 |
{ |
1986 |
var control = currentControl as DateControl; |
1987 |
if (control != null) |
1988 |
{ |
1989 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1990 |
} |
1991 |
} |
1992 |
break; |
1993 |
|
1994 |
case ControlType.ArrowTextControl: |
1995 |
case ControlType.ArrowTransTextControl: |
1996 |
case ControlType.ArrowTextBorderControl: |
1997 |
case ControlType.ArrowTransTextBorderControl: |
1998 |
case ControlType.ArrowTextCloudControl: |
1999 |
case ControlType.ArrowTransTextCloudControl: |
2000 |
{ |
2001 |
var control = currentControl as ArrowTextControl; |
2002 |
if (control != null) |
2003 |
{ |
2004 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2005 |
} |
2006 |
} |
2007 |
break; |
2008 |
|
2009 |
case ControlType.PolygonControl: |
2010 |
case ControlType.ChainLine: |
2011 |
{ |
2012 |
var control = currentControl as PolygonControl; |
2013 |
if (control != null) |
2014 |
{ |
2015 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2016 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
2017 |
control.Paint = ViewerDataModel.Instance.paintSet; |
2018 |
} |
2019 |
} |
2020 |
break; |
2021 |
|
2022 |
case ControlType.Sign: |
2023 |
{ |
2024 |
var control = currentControl as SignControl; |
2025 |
if (control != null) |
2026 |
{ |
2027 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2028 |
} |
2029 |
} |
2030 |
break; |
2031 |
|
2032 |
case ControlType.Symbol: |
2033 |
{ |
2034 |
var control = currentControl as SymControl; |
2035 |
if (control != null) |
2036 |
{ |
2037 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2038 |
} |
2039 |
} |
2040 |
break; |
2041 |
|
2042 |
case ControlType.Stamp: |
2043 |
{ |
2044 |
var control = currentControl as SymControlN; |
2045 |
if (control != null) |
2046 |
{ |
2047 |
if (control.STAMP != null) |
2048 |
{ |
2049 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2050 |
} |
2051 |
else |
2052 |
{ |
2053 |
currentControl = null; |
2054 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2055 |
DialogMessage_Alert("Approved Stamp 가 등록되어 있지 않습니다. \n관리자에게 문의하세요.", "안내"); |
2056 |
} |
2057 |
} |
2058 |
} |
2059 |
break; |
2060 |
|
2061 |
case ControlType.Rectangle: |
2062 |
case ControlType.Mark: |
2063 |
{ |
2064 |
var control = currentControl as RectangleControl; |
2065 |
if (control != null) |
2066 |
{ |
2067 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2068 |
if (control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill; |
2069 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
2070 |
} |
2071 |
} |
2072 |
break; |
2073 |
|
2074 |
case ControlType.PenControl: |
2075 |
{ |
2076 |
stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
2077 |
//inkBoard.Strokes.Add(stroke); |
2078 |
} |
2079 |
break; |
2080 |
|
2081 |
default: |
2082 |
break; |
2083 |
} |
2084 |
|
2085 |
#endregion // 각 컨트롤의 특별한 기능을 제어한다. |
2086 |
|
2087 |
if (ViewerDataModel.Instance.MarkupAngleVisibility == Visibility.Visible) |
2088 |
{ |
2089 |
ViewerDataModel.Instance.MarkupAngle = currentControl.CommentAngle; |
2090 |
} |
2091 |
} |
2092 |
} |
2093 |
else if (mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed) |
2094 |
{ |
2095 |
Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
2096 |
Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
2097 |
SetCursor(); |
2098 |
if (currentControl == null) |
2099 |
{ |
2100 |
switch (controlType) |
2101 |
{ |
2102 |
case ControlType.PenControl: |
2103 |
{ |
2104 |
if (inkBoard.Tag.ToString() == "Ink") |
2105 |
{ |
2106 |
stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
2107 |
} |
2108 |
else if (inkBoard.Tag.ToString() == "EraseByPoint") |
2109 |
{ |
2110 |
RemovePointStroke(currentCanvasDrawingMouseMovePoint); |
2111 |
} |
2112 |
else if (inkBoard.Tag.ToString() == "EraseByStroke") |
2113 |
{ |
2114 |
RemoveLineStroke(currentCanvasDrawingMouseMovePoint); |
2115 |
} |
2116 |
|
2117 |
//inkBoard.Strokes.Add(stroke); |
2118 |
} |
2119 |
break; |
2120 |
} |
2121 |
return; |
2122 |
} |
2123 |
} |
2124 |
else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || |
2125 |
((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || |
2126 |
((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom)) |
2127 |
{ |
2128 |
Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas); |
2129 |
|
2130 |
if (isDraggingSelectionRect) |
2131 |
{ |
2132 |
UpdateDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint); |
2133 |
e.Handled = true; |
2134 |
} |
2135 |
else if (isLeftMouseButtonDownOnWindow) |
2136 |
{ |
2137 |
var dragDelta = curMouseDownPoint - CanvasDrawingMouseDownPoint; |
2138 |
double dragDistance = Math.Abs(dragDelta.Length); |
2139 |
|
2140 |
if (dragDistance > DragThreshold) |
2141 |
{ |
2142 |
isDraggingSelectionRect = true; |
2143 |
InitDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint); |
2144 |
} |
2145 |
|
2146 |
e.Handled = true; |
2147 |
} |
2148 |
|
2149 |
if (CanvasDrawingMouseDownPoint == curMouseDownPoint) |
2150 |
{ |
2151 |
} |
2152 |
else |
2153 |
{ |
2154 |
e.Handled = true; |
2155 |
} |
2156 |
} |
2157 |
/* |
2158 |
else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol) |
2159 |
{ //symbol |
2160 |
if(_dragdropWindow != null) |
2161 |
{ |
2162 |
Win32Point w32Mouse = new Win32Point(); |
2163 |
GetCursorPos(ref w32Mouse); |
2164 |
|
2165 |
this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2); |
2166 |
this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2); |
2167 |
} |
2168 |
} |
2169 |
*/ |
2170 |
else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) && |
2171 |
(e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
2172 |
{ |
2173 |
var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault(); |
2174 |
if (control != null) |
2175 |
{ |
2176 |
this.cursor = Cursors.Hand; |
2177 |
SetCursor(); |
2178 |
} |
2179 |
else |
2180 |
{ |
2181 |
if (this.Cursor != Cursors.None) |
2182 |
{ |
2183 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2184 |
SetCursor(); |
2185 |
} |
2186 |
} |
2187 |
} |
2188 |
else |
2189 |
{ |
2190 |
} |
2191 |
} |
2192 |
|
2193 |
private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e) |
2194 |
{ |
2195 |
if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed)) |
2196 |
{ |
2197 |
SetCursor(); |
2198 |
Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2); |
2199 |
Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2); |
2200 |
|
2201 |
Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
2202 |
|
2203 |
ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X; |
2204 |
ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y; |
2205 |
|
2206 |
if (Sync.IsChecked) |
2207 |
{ |
2208 |
zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX; |
2209 |
zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY; |
2210 |
} |
2211 |
} |
2212 |
} |
2213 |
|
2214 |
private List<CommentUserInfo> hitList = new List<CommentUserInfo>(); |
2215 |
|
2216 |
private EllipseGeometry hitArea = new EllipseGeometry(); |
2217 |
|
2218 |
private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e) |
2219 |
{ |
2220 |
IsDrawing = false; |
2221 |
|
2222 |
if (mouseHandlingMode != MouseHandlingMode.None) |
2223 |
{ |
2224 |
if (mouseHandlingMode == MouseHandlingMode.Drawing) |
2225 |
{ |
2226 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2227 |
|
2228 |
SetCursor(); |
2229 |
|
2230 |
switch (controlType) |
2231 |
{ |
2232 |
case ControlType.None: |
2233 |
break; |
2234 |
|
2235 |
case ControlType.Rectangle: |
2236 |
{ |
2237 |
} |
2238 |
break; |
2239 |
|
2240 |
case ControlType.PenControl: |
2241 |
{ |
2242 |
} |
2243 |
break; |
2244 |
|
2245 |
default: |
2246 |
break; |
2247 |
} |
2248 |
} |
2249 |
else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left) |
2250 |
{ |
2251 |
if (isLeftMouseButtonDownOnWindow) |
2252 |
{ |
2253 |
bool wasDragSelectionApplied = false; |
2254 |
|
2255 |
if (isDraggingSelectionRect) |
2256 |
{ |
2257 |
if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl) |
2258 |
{ |
2259 |
dragCaptureBorder.Visibility = Visibility.Collapsed; |
2260 |
mouseHandlingMode = MouseHandlingMode.None; |
2261 |
Point endPoint = e.GetPosition(zoomAndPanCanvas); |
2262 |
symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex; |
2263 |
Set_Symbol_Capture(endPoint); |
2264 |
ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed; |
2265 |
ViewerDataModel.Instance.ViewVisible = Visibility.Visible; |
2266 |
ViewerDataModel.Instance.Capture_Opacity = 0; |
2267 |
} |
2268 |
else if (mouseHandlingMode == MouseHandlingMode.Capture) |
2269 |
{ |
2270 |
dragCaptureBorder.Visibility = Visibility.Collapsed; |
2271 |
mouseHandlingMode = MouseHandlingMode.None; |
2272 |
Set_Capture(); |
2273 |
|
2274 |
ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed; |
2275 |
ViewerDataModel.Instance.ViewVisible = Visibility.Visible; |
2276 |
ViewerDataModel.Instance.Capture_Opacity = 0; |
2277 |
} |
2278 |
else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2279 |
{ |
2280 |
ApplyDragSelectionRect(); |
2281 |
} |
2282 |
else |
2283 |
{ |
2284 |
double x = Canvas.GetLeft(dragZoomBorder); |
2285 |
double y = Canvas.GetTop(dragZoomBorder); |
2286 |
double width = dragZoomBorder.Width; |
2287 |
double height = dragZoomBorder.Height; |
2288 |
Rect dragRect = new Rect(x, y, width, height); |
2289 |
|
2290 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect); |
2291 |
|
2292 |
dragZoomBorder.Visibility = Visibility.Collapsed; |
2293 |
} |
2294 |
|
2295 |
isDraggingSelectionRect = false; |
2296 |
e.Handled = true; |
2297 |
wasDragSelectionApplied = true; |
2298 |
} |
2299 |
|
2300 |
if (isLeftMouseButtonDownOnWindow) |
2301 |
{ |
2302 |
isLeftMouseButtonDownOnWindow = false; |
2303 |
this.ReleaseMouseCapture(); |
2304 |
e.Handled = true; |
2305 |
} |
2306 |
|
2307 |
if (!wasDragSelectionApplied) |
2308 |
{ |
2309 |
init(); |
2310 |
} |
2311 |
} |
2312 |
} |
2313 |
else if (e.RightButton == MouseButtonState.Pressed) |
2314 |
{ |
2315 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2316 |
SetCursor(); |
2317 |
} |
2318 |
|
2319 |
zoomAndPanControl.ReleaseMouseCapture(); |
2320 |
|
2321 |
e.Handled = true; |
2322 |
} |
2323 |
else |
2324 |
{ |
2325 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2326 |
SetCursor(); |
2327 |
} |
2328 |
|
2329 |
///mouseButtonDown = MouseButton.Left; |
2330 |
//controlType = ControlType.SingleLine; |
2331 |
} |
2332 |
|
2333 |
public void Set_Symbol_Capture(Point endPoint) |
2334 |
{ |
2335 |
double x = CanvasDrawingMouseDownPoint.X; |
2336 |
double y = CanvasDrawingMouseDownPoint.Y; |
2337 |
if (x > endPoint.X) |
2338 |
{ |
2339 |
x = endPoint.X; |
2340 |
y = endPoint.Y; |
2341 |
} |
2342 |
|
2343 |
double width = dragCaptureBorder.Width; |
2344 |
double height = dragCaptureBorder.Height; |
2345 |
|
2346 |
canvasImage = ConverterBitmapImage(zoomAndPanCanvas); |
2347 |
|
2348 |
if (x < 0) |
2349 |
{ |
2350 |
width += x; |
2351 |
x = 0; |
2352 |
} |
2353 |
if (y < 0) |
2354 |
{ |
2355 |
height += y; |
2356 |
y = 0; |
2357 |
|
2358 |
width = (int)canvasImage.PixelWidth - x; |
2359 |
} |
2360 |
if (x + width > canvasImage.PixelWidth) |
2361 |
{ |
2362 |
width = (int)canvasImage.PixelWidth - x; |
2363 |
} |
2364 |
if (y + height > canvasImage.PixelHeight) |
2365 |
{ |
2366 |
height = (int)canvasImage.PixelHeight - y; |
2367 |
} |
2368 |
var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height); |
2369 |
|
2370 |
string uri = this.GetImageURL(_ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber); |
2371 |
var defaultBitmapImage = new BitmapImage(); |
2372 |
defaultBitmapImage.BeginInit(); |
2373 |
defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
2374 |
defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
2375 |
defaultBitmapImage.UriSource = new Uri(uri); |
2376 |
defaultBitmapImage.EndInit(); |
2377 |
|
2378 |
//GC.Collect(); |
2379 |
|
2380 |
if (defaultBitmapImage.IsDownloading) |
2381 |
{ |
2382 |
defaultBitmapImage.DownloadCompleted += (ex, arg) => |
2383 |
{ |
2384 |
defaultBitmapImage.Freeze(); |
2385 |
//GC.Collect(); |
2386 |
BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect); |
2387 |
Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height); |
2388 |
}; |
2389 |
} |
2390 |
} |
2391 |
|
2392 |
private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e) |
2393 |
{ |
2394 |
///mouseButtonDown = MouseButton.Left; |
2395 |
} |
2396 |
|
2397 |
private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e) |
2398 |
{ |
2399 |
///mouseButtonDown = MouseButton.Left; |
2400 |
//this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2401 |
} |
2402 |
|
2403 |
private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
2404 |
{ |
2405 |
} |
2406 |
|
2407 |
/// <summary> |
2408 |
/// select items by dragging |
2409 |
/// </summary> |
2410 |
private void ApplyDragSelectionRect() |
2411 |
{ |
2412 |
dragSelectionBorder.Visibility = Visibility.Collapsed; |
2413 |
|
2414 |
double x = Canvas.GetLeft(dragSelectionBorder); |
2415 |
double y = Canvas.GetTop(dragSelectionBorder); |
2416 |
double width = dragSelectionBorder.Width; |
2417 |
double height = dragSelectionBorder.Height; |
2418 |
Boolean Flag = false; |
2419 |
List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
2420 |
var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList(); |
2421 |
|
2422 |
Rect dragRect = new Rect(x, y, width, height); |
2423 |
///dragRect.Inflate(width / 10, height / 10); |
2424 |
|
2425 |
foreach (var item in Items) |
2426 |
{ |
2427 |
Flag = SelectionSet.Instance.SelectControl(item, dragRect); |
2428 |
|
2429 |
if (Flag) |
2430 |
{ |
2431 |
adornerSet.Add(item); |
2432 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
2433 |
Control_Style(item); |
2434 |
} |
2435 |
} |
2436 |
if (adornerSet.Count > 0) |
2437 |
{ |
2438 |
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
2439 |
SelectLayer.Children.Add(final); |
2440 |
} |
2441 |
} |
2442 |
|
2443 |
private void InitDragSelectionRect(Point pt1, Point pt2) |
2444 |
{ |
2445 |
//캡쳐 중 |
2446 |
if (mouseHandlingMode == MouseHandlingMode.Capture) |
2447 |
{ |
2448 |
dragCaptureBorder.Visibility = Visibility.Visible; |
2449 |
} |
2450 |
//선택 중 |
2451 |
else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2452 |
{ |
2453 |
dragSelectionBorder.Visibility = Visibility.Visible; |
2454 |
} |
2455 |
else |
2456 |
{ |
2457 |
dragZoomBorder.Visibility = Visibility.Visible; |
2458 |
} |
2459 |
UpdateDragSelectionRect(pt1, pt2); |
2460 |
} |
2461 |
|
2462 |
/// <summary> |
2463 |
/// Update the position and size of the rectangle used for drag selection. |
2464 |
/// </summary> |
2465 |
private void UpdateDragSelectionRect(Point pt1, Point pt2) |
2466 |
{ |
2467 |
double x, y, width, height; |
2468 |
|
2469 |
// |
2470 |
// Determine x,y,width and height of the rect inverting the points if necessary. |
2471 |
// |
2472 |
|
2473 |
if (pt2.X < pt1.X) |
2474 |
{ |
2475 |
x = pt2.X; |
2476 |
width = pt1.X - pt2.X; |
2477 |
} |
2478 |
else |
2479 |
{ |
2480 |
x = pt1.X; |
2481 |
width = pt2.X - pt1.X; |
2482 |
} |
2483 |
|
2484 |
if (pt2.Y < pt1.Y) |
2485 |
{ |
2486 |
y = pt2.Y; |
2487 |
height = pt1.Y - pt2.Y; |
2488 |
} |
2489 |
else |
2490 |
{ |
2491 |
y = pt1.Y; |
2492 |
height = pt2.Y - pt1.Y; |
2493 |
} |
2494 |
|
2495 |
// |
2496 |
// Update the coordinates of the rectangle used for drag selection. |
2497 |
// |
2498 |
//캡쳐 중 |
2499 |
if (mouseHandlingMode == MouseHandlingMode.Capture) |
2500 |
{ |
2501 |
Canvas.SetLeft(dragCaptureBorder, x); |
2502 |
Canvas.SetTop(dragCaptureBorder, y); |
2503 |
dragCaptureBorder.Width = width; |
2504 |
dragCaptureBorder.Height = height; |
2505 |
} |
2506 |
//선택 중 |
2507 |
else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2508 |
{ |
2509 |
Canvas.SetLeft(dragSelectionBorder, x); |
2510 |
Canvas.SetTop(dragSelectionBorder, y); |
2511 |
dragSelectionBorder.Width = width; |
2512 |
dragSelectionBorder.Height = height; |
2513 |
} |
2514 |
else |
2515 |
{ |
2516 |
Canvas.SetLeft(dragZoomBorder, x); |
2517 |
Canvas.SetTop(dragZoomBorder, y); |
2518 |
dragZoomBorder.Width = width; |
2519 |
dragZoomBorder.Height = height; |
2520 |
} |
2521 |
} |
2522 |
|
2523 |
private void drawingPannelRotate(double angle) |
2524 |
{ |
2525 |
Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1); |
2526 |
rotate.Angle = angle; |
2527 |
var rotationNum = Math.Abs((rotate.Angle / 90)); |
2528 |
|
2529 |
if (angle == 90 || angle == 270) |
2530 |
{ |
2531 |
double emptySize = zoomAndPanCanvas.Width; |
2532 |
zoomAndPanCanvas.Width = zoomAndPanCanvas.Height; |
2533 |
zoomAndPanCanvas.Height = emptySize; |
2534 |
} |
2535 |
if (angle == 0) |
2536 |
{ |
2537 |
translate.X = 0; |
2538 |
translate.Y = 0; |
2539 |
} |
2540 |
else if (angle == 90) |
2541 |
{ |
2542 |
translate.X = zoomAndPanCanvas.Width; |
2543 |
translate.Y = 0; |
2544 |
} |
2545 |
else if (angle == 180) |
2546 |
{ |
2547 |
translate.X = zoomAndPanCanvas.Width; |
2548 |
translate.Y = zoomAndPanCanvas.Height; |
2549 |
} |
2550 |
else |
2551 |
{ |
2552 |
translate.X = 0; |
2553 |
translate.Y = zoomAndPanCanvas.Height; |
2554 |
} |
2555 |
|
2556 |
zoomAndPanControl.RotationAngle = rotate.Angle; |
2557 |
|
2558 |
if (!testPanel2.IsHidden) |
2559 |
{ |
2560 |
zoomAndPanControl2.RotationAngle = rotate.Angle; |
2561 |
zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width; |
2562 |
zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height; |
2563 |
} |
2564 |
|
2565 |
ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width; |
2566 |
ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height; |
2567 |
ViewerDataModel.Instance.AngleOffsetX = translate.X; |
2568 |
ViewerDataModel.Instance.AngleOffsetY = translate.Y; |
2569 |
ViewerDataModel.Instance.MarkupAngle = rotate.Angle; |
2570 |
} |
2571 |
|
2572 |
private void syncPannelRotate(double angle) |
2573 |
{ |
2574 |
//Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1); |
2575 |
rotate.Angle = angle; |
2576 |
var rotationNum = Math.Abs((rotate.Angle / 90)); |
2577 |
|
2578 |
if (angle == 90 || angle == 270) |
2579 |
{ |
2580 |
double emptySize = zoomAndPanCanvas2.Width; |
2581 |
zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height; |
2582 |
zoomAndPanCanvas2.Height = emptySize; |
2583 |
} |
2584 |
if (angle == 0) |
2585 |
{ |
2586 |
translate2.X = 0; |
2587 |
translate2.Y = 0; |
2588 |
} |
2589 |
else if (angle == 90) |
2590 |
{ |
2591 |
translate2.X = zoomAndPanCanvas2.Width; |
2592 |
translate2.Y = 0; |
2593 |
} |
2594 |
else if (angle == 180) |
2595 |
{ |
2596 |
translate2.X = zoomAndPanCanvas2.Width; |
2597 |
translate2.Y = zoomAndPanCanvas2.Height; |
2598 |
} |
2599 |
else |
2600 |
{ |
2601 |
translate2.X = 0; |
2602 |
translate2.Y = zoomAndPanCanvas2.Height; |
2603 |
} |
2604 |
|
2605 |
zoomAndPanControl2.RotationAngle = rotate.Angle; |
2606 |
} |
2607 |
|
2608 |
public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint) |
2609 |
{ |
2610 |
string Data_ = ""; |
2611 |
|
2612 |
try |
2613 |
{ |
2614 |
//Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1); |
2615 |
Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex); |
2616 |
if (Data_ != null || Data_ != "") |
2617 |
{ |
2618 |
//Logger.sendResLog("GetSymbolImageURL", "TRUE", 1); |
2619 |
} |
2620 |
else |
2621 |
{ |
2622 |
//Logger.sendResLog("GetSymbolImageURL", "FALSE", 1); |
2623 |
} |
2624 |
|
2625 |
//MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP |
2626 |
//{ |
2627 |
// SYMBOL_ID = id,//InnerItem.Symbol_ID |
2628 |
// STATE = 0, |
2629 |
//}; |
2630 |
if (Data_ != null) |
2631 |
{ |
2632 |
Image img = new Image(); |
2633 |
//img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_)); |
2634 |
if (Data_.Contains(".svg")) |
2635 |
{ |
2636 |
byte[] imageData = null; |
2637 |
DrawingImage image = null; |
2638 |
using (System.Net.WebClient web = new System.Net.WebClient()) |
2639 |
{ |
2640 |
imageData = web.DownloadData(new Uri(Data_)); |
2641 |
System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
2642 |
image = SvgReader.Load(stream); |
2643 |
} |
2644 |
img.Source = image; |
2645 |
} |
2646 |
else |
2647 |
{ |
2648 |
img.Source = new BitmapImage(new Uri(Data_)); |
2649 |
} |
2650 |
|
2651 |
var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
2652 |
{ |
2653 |
PointSet = new List<Point>(), |
2654 |
FilePath = Data_, |
2655 |
ImageData = img.Source, |
2656 |
StartPoint = canvasZoomPanningMouseDownPoint, |
2657 |
EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, |
2658 |
canvasZoomPanningMouseDownPoint.Y + img.Source.Height), |
2659 |
TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, |
2660 |
canvasZoomPanningMouseDownPoint.Y), |
2661 |
LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X, |
2662 |
canvasZoomPanningMouseDownPoint.Y + img.Source.Height) |
2663 |
}; |
2664 |
|
2665 |
currentControl.PointSet = new List<Point> |
2666 |
{ |
2667 |
currentControl.StartPoint, |
2668 |
currentControl.LeftBottomPoint, |
2669 |
currentControl.EndPoint, |
2670 |
currentControl.TopRightPoint, |
2671 |
}; |
2672 |
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
2673 |
UndoData = new Undo_data() |
2674 |
{ |
2675 |
IsUndo = false, |
2676 |
Event = Event_Type.Create, |
2677 |
EventTime = DateTime.Now, |
2678 |
Markup_List = new List<Multi_Undo_data>() |
2679 |
}; |
2680 |
ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
2681 |
{ |
2682 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
2683 |
}); |
2684 |
|
2685 |
//multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
2686 |
multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
2687 |
UndoData.Markup_List.Add(multi_Undo_Data); |
2688 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
2689 |
|
2690 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
2691 |
currentControl.CommentID = Commons.shortGuid(); |
2692 |
currentControl.SymbolID = id; |
2693 |
currentControl.GroupID = group_id; |
2694 |
currentControl.ApplyTemplate(); |
2695 |
currentControl.SetImage(); |
2696 |
|
2697 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
2698 |
Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
2699 |
SelectLayer.Children.Add(final); |
2700 |
} |
2701 |
} |
2702 |
catch (Exception ex) |
2703 |
{ |
2704 |
this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error"); |
2705 |
} |
2706 |
} |
2707 |
|
2708 |
// 저장전 textbox 입력 완료 때문에 public로 하여 savecommand에서 호출하도록 임시로 함. |
2709 |
public async void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e) |
2710 |
{ |
2711 |
var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault(); |
2712 |
if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText)) |
2713 |
{ |
2714 |
set_option.Value = double.Parse(set_option.ContentText); |
2715 |
//set_option.Focusable = false; |
2716 |
zoomAndPanControl.Focus(); |
2717 |
} |
2718 |
|
2719 |
ConvertInkControlToPolygon(); |
2720 |
|
2721 |
// 텍스트가 없으면 삭제됨 |
2722 |
var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data => |
2723 |
(data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault(); |
2724 |
|
2725 |
if (text_item != null && (currentControl as ArrowTextControl) == null) |
2726 |
{ |
2727 |
DeleteCommand.Instance.Execute(new[] { text_item }); |
2728 |
//ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item); |
2729 |
} |
2730 |
|
2731 |
/// up to here |
2732 |
|
2733 |
foreach (var item in ViewerDataModel.Instance.MarkupControls_USER) |
2734 |
{ |
2735 |
if (item as ArrowTextControl != null) |
2736 |
{ |
2737 |
(item as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
2738 |
} |
2739 |
else if (item as TextControl != null) |
2740 |
{ |
2741 |
(item as TextControl).Base_TextBox.IsHitTestVisible = false; |
2742 |
} |
2743 |
} |
2744 |
|
2745 |
//if (currentControl != null) |
2746 |
{ |
2747 |
var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).IsEditingMode == true).FirstOrDefault(); |
2748 |
if (text_item_ != null) |
2749 |
{ |
2750 |
(text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible; |
2751 |
(text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed; |
2752 |
(text_item_ as TextControl).IsEditingMode = false; |
2753 |
currentControl = null; |
2754 |
} |
2755 |
|
2756 |
var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault(); |
2757 |
if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false)) |
2758 |
{ |
2759 |
(Arrowtext_item_ as ArrowTextControl).IsEditingMode = false; |
2760 |
(Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false; |
2761 |
currentControl = null; |
2762 |
} |
2763 |
} |
2764 |
|
2765 |
double Ang = 0; |
2766 |
if (rotate.Angle != 0) |
2767 |
{ |
2768 |
Ang = 360 - rotate.Angle; |
2769 |
} |
2770 |
|
2771 |
if (e.OriginalSource is System.Windows.Controls.Image) |
2772 |
{ |
2773 |
(e.OriginalSource as System.Windows.Controls.Image).Focus(); |
2774 |
} |
2775 |
/* |
2776 |
if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed) |
2777 |
{ |
2778 |
canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
2779 |
if(symbol_id != null) |
2780 |
{ |
2781 |
PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint); |
2782 |
} |
2783 |
} |
2784 |
|
2785 |
if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed) |
2786 |
{ |
2787 |
if (this._dragdropWindow != null) |
2788 |
{ |
2789 |
this._dragdropWindow.Close(); |
2790 |
this._dragdropWindow = null; |
2791 |
symbol_id = null; |
2792 |
} |
2793 |
} |
2794 |
*/ |
2795 |
|
2796 |
if (e.LeftButton == MouseButtonState.Pressed) |
2797 |
{ |
2798 |
CanvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas); |
2799 |
canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
2800 |
|
2801 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2802 |
SetCursor(); |
2803 |
|
2804 |
if (!ViewerDataModel.Instance.IsPressCtrl) |
2805 |
{ |
2806 |
SelectionSet.Instance.UnSelect(this); |
2807 |
} |
2808 |
} |
2809 |
|
2810 |
if (e.MiddleButton == MouseButtonState.Pressed) |
2811 |
{ |
2812 |
canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
2813 |
cursor = Cursors.SizeAll; |
2814 |
SetCursor(); |
2815 |
} |
2816 |
if (e.RightButton == MouseButtonState.Pressed) |
2817 |
{ |
2818 |
canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
2819 |
cursor = Cursors.SizeAll; |
2820 |
SetCursor(); |
2821 |
} |
2822 |
else if (e.XButton1 == MouseButtonState.Pressed) |
2823 |
{ |
2824 |
if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount) |
2825 |
{ |
2826 |
this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1); |
2827 |
} |
2828 |
|
2829 |
//this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber); |
2830 |
} |
2831 |
else if (e.XButton2 == MouseButtonState.Pressed) |
2832 |
{ |
2833 |
if (this.pageNavigator.CurrentPage.PageNumber > 1) |
2834 |
{ |
2835 |
this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1); |
2836 |
} |
2837 |
} |
2838 |
|
2839 |
bool isArrowTextEdit = false; |
2840 |
|
2841 |
if (currentControl is ArrowTextControl textControl) |
2842 |
{ |
2843 |
if (textControl.IsEditingMode) |
2844 |
isArrowTextEdit = true; |
2845 |
} |
2846 |
|
2847 |
if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null) |
2848 |
{ |
2849 |
if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2850 |
{ |
2851 |
if (SelectLayer.Children.Count == 0) |
2852 |
{ |
2853 |
isLeftMouseButtonDownOnWindow = true; |
2854 |
mouseHandlingMode = MouseHandlingMode.Selecting; |
2855 |
} |
2856 |
|
2857 |
if (controlType == ControlType.None) |
2858 |
{ |
2859 |
isLeftMouseButtonDownOnWindow = true; |
2860 |
} |
2861 |
} |
2862 |
|
2863 |
/// 캡쳐 모드 설정 |
2864 |
if (mouseHandlingMode == MouseHandlingMode.Capture) |
2865 |
{ |
2866 |
dragCaptureBorder.Visibility = Visibility.Visible; |
2867 |
isLeftMouseButtonDownOnWindow = true; |
2868 |
} |
2869 |
|
2870 |
/// 줌 모드 설정 |
2871 |
if (mouseHandlingMode == MouseHandlingMode.DragZoom) |
2872 |
{ |
2873 |
isLeftMouseButtonDownOnWindow = true; |
2874 |
} |
2875 |
|
2876 |
var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault(); |
2877 |
|
2878 |
if (control == null) |
2879 |
{ |
2880 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
2881 |
} |
2882 |
else |
2883 |
{ |
2884 |
if (ControlTypeExtansions.LineTypes.Contains(control.ControlType)) |
2885 |
{ |
2886 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
2887 |
} |
2888 |
|
2889 |
AdornerFinal final = null; |
2890 |
|
2891 |
if (!ViewerDataModel.Instance.IsPressCtrl) |
2892 |
{ |
2893 |
/// 기존 selection 해제 |
2894 |
SelectionSet.Instance.UnSelect(this); |
2895 |
|
2896 |
final = new AdornerFinal(control); |
2897 |
|
2898 |
this.Control_Style(control); |
2899 |
|
2900 |
if ((control as IPath) != null) |
2901 |
{ |
2902 |
if ((control as IPath).LineSize != 0) |
2903 |
{ |
2904 |
ViewerDataModel.Instance.LineSize = (control as IPath).LineSize; |
2905 |
} |
2906 |
} |
2907 |
if ((control as IShapeControl) != null) |
2908 |
{ |
2909 |
if ((control as IShapeControl).Paint == PaintSet.Hatch) |
2910 |
{ |
2911 |
ViewerDataModel.Instance.checkHatchShape = true; |
2912 |
} |
2913 |
else if ((control as IShapeControl).Paint == PaintSet.Fill) |
2914 |
{ |
2915 |
ViewerDataModel.Instance.checkFillShape = true; |
2916 |
} |
2917 |
else |
2918 |
{ |
2919 |
ViewerDataModel.Instance.checkHatchShape = false; |
2920 |
ViewerDataModel.Instance.checkFillShape = false; |
2921 |
} |
2922 |
ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint; |
2923 |
} |
2924 |
|
2925 |
ViewerDataModel.Instance.ControlOpacity = control.Opacity; |
2926 |
|
2927 |
if ((control as TextControl) != null) |
2928 |
{ |
2929 |
ViewerDataModel.Instance.SystemMain.dzTopMenu.SetFont((control as TextControl).TextFamily); |
2930 |
|
2931 |
if (!((control as TextControl).EnableEditing)) |
2932 |
{ |
2933 |
(control as TextControl).EnableEditing = true; |
2934 |
} |
2935 |
if ((control as TextControl).TextStyle == FontStyles.Italic) |
2936 |
{ |
2937 |
ViewerDataModel.Instance.checkTextStyle = true; |
2938 |
} |
2939 |
else |
2940 |
{ |
2941 |
ViewerDataModel.Instance.checkTextStyle = false; |
2942 |
} |
2943 |
if ((control as TextControl).TextWeight == FontWeights.Bold) |
2944 |
{ |
2945 |
ViewerDataModel.Instance.checkTextWeight = true; |
2946 |
} |
2947 |
else |
2948 |
{ |
2949 |
ViewerDataModel.Instance.checkTextWeight = false; |
2950 |
} |
2951 |
if ((control as TextControl).UnderLine == TextDecorations.Underline) |
2952 |
{ |
2953 |
ViewerDataModel.Instance.checkUnderLine = true; |
2954 |
} |
2955 |
else |
2956 |
{ |
2957 |
ViewerDataModel.Instance.checkUnderLine = false; |
2958 |
} |
2959 |
ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize; |
2960 |
ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight; |
2961 |
} |
2962 |
else if ((control as ArrowTextControl) != null) |
2963 |
{ |
2964 |
ViewerDataModel.Instance.SystemMain.dzTopMenu.SetFont((control as ArrowTextControl).TextFamily); |
2965 |
|
2966 |
if (!((control as ArrowTextControl).EnableEditing)) |
2967 |
{ |
2968 |
(control as ArrowTextControl).EnableEditing = true; |
2969 |
} |
2970 |
if ((control as ArrowTextControl).TextStyle == FontStyles.Italic) |
2971 |
{ |
2972 |
ViewerDataModel.Instance.checkTextStyle = true; |
2973 |
} |
2974 |
else |
2975 |
{ |
2976 |
ViewerDataModel.Instance.checkTextStyle = false; |
2977 |
} |
2978 |
if ((control as ArrowTextControl).TextWeight == FontWeights.Bold) |
2979 |
{ |
2980 |
ViewerDataModel.Instance.checkTextWeight = true; |
2981 |
} |
2982 |
else |
2983 |
{ |
2984 |
ViewerDataModel.Instance.checkTextWeight = false; |
2985 |
} |
2986 |
if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline) |
2987 |
{ |
2988 |
ViewerDataModel.Instance.checkUnderLine = true; |
2989 |
} |
2990 |
else |
2991 |
{ |
2992 |
ViewerDataModel.Instance.checkUnderLine = false; |
2993 |
} |
2994 |
ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight; |
2995 |
ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize; |
2996 |
} |
2997 |
else if ((control as RectCloudControl) != null) |
2998 |
{ |
2999 |
ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength; |
3000 |
} |
3001 |
else if ((control as CloudControl) != null) |
3002 |
{ |
3003 |
ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength; |
3004 |
} |
3005 |
} |
3006 |
else |
3007 |
{ |
3008 |
List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems; |
3009 |
SelectionSet.Instance.UnSelect(this); |
3010 |
comment.Add(control); |
3011 |
|
3012 |
Control_Style(control); |
3013 |
|
3014 |
final = new AdornerFinal(comment); |
3015 |
} |
3016 |
|
3017 |
if (final != null) |
3018 |
{ |
3019 |
this.SelectLayer.Children.Add(final); |
3020 |
} |
3021 |
} |
3022 |
} |
3023 |
else if (mouseHandlingMode == MouseHandlingMode.Drawing) |
3024 |
{ |
3025 |
|
3026 |
|
3027 |
init(); |
3028 |
//강인구 추가(우 클릭 일 경우 커서 변경 하지 않음) |
3029 |
if (cursor != Cursors.SizeAll) |
3030 |
{ |
3031 |
cursor = Cursors.Cross; |
3032 |
SetCursor(); |
3033 |
} |
3034 |
bool init_user = false; |
3035 |
foreach (var user in gridViewMarkup.Items) |
3036 |
{ |
3037 |
if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID) |
3038 |
{ |
3039 |
init_user = true; |
3040 |
} |
3041 |
} |
3042 |
if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed) |
3043 |
{ |
3044 |
// 기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요 |
3045 |
RadWindow.Alert(new DialogParameters |
3046 |
{ |
3047 |
Owner = Application.Current.MainWindow, |
3048 |
Theme = new VisualStudio2013Theme(), |
3049 |
Header = "Info", |
3050 |
Content = "Existing comments already existed. Select from the user list first", |
3051 |
}); |
3052 |
return; |
3053 |
} |
3054 |
else |
3055 |
{ |
3056 |
var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem; |
3057 |
if (item != null) |
3058 |
{ |
3059 |
App.Custom_ViewInfoId = item.MarkupInfoID; |
3060 |
} |
3061 |
} |
3062 |
|
3063 |
switch (controlType) |
3064 |
{ |
3065 |
case ControlType.Coordinate: |
3066 |
{ |
3067 |
if (e.LeftButton == MouseButtonState.Pressed) |
3068 |
{ |
3069 |
if (currentControl is CoordinateControl) |
3070 |
{ |
3071 |
if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3072 |
{ |
3073 |
return; |
3074 |
} |
3075 |
|
3076 |
CreateCommand.Instance.Execute(currentControl); |
3077 |
|
3078 |
currentControl = null; |
3079 |
this.cursor = Cursors.Arrow; |
3080 |
} |
3081 |
else |
3082 |
{ |
3083 |
this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
3084 |
if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber |
3085 |
&& d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0) |
3086 |
{ |
3087 |
currentControl = null; |
3088 |
this.cursor = Cursors.Arrow; |
3089 |
Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice"); |
3090 |
return; |
3091 |
} |
3092 |
else |
3093 |
{ |
3094 |
currentControl = new CoordinateControl |
3095 |
{ |
3096 |
Background = new SolidColorBrush(Colors.Black), |
3097 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3098 |
ControlType = ControlType.Coordinate |
3099 |
}; |
3100 |
|
3101 |
currentControl.CommentID = Commons.shortGuid(); |
3102 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3103 |
currentControl.IsNew = true; |
3104 |
|
3105 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3106 |
|
3107 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3108 |
} |
3109 |
} |
3110 |
} |
3111 |
} |
3112 |
break; |
3113 |
|
3114 |
case ControlType.InsideWhite: |
3115 |
{ |
3116 |
if (e.LeftButton == MouseButtonState.Pressed) |
3117 |
{ |
3118 |
if (currentControl is InsideWhiteControl) |
3119 |
{ |
3120 |
if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3121 |
{ |
3122 |
return; |
3123 |
} |
3124 |
|
3125 |
CreateCommand.Instance.Execute(currentControl); |
3126 |
|
3127 |
currentControl = null; |
3128 |
this.cursor = Cursors.Arrow; |
3129 |
} |
3130 |
else |
3131 |
{ |
3132 |
currentControl = new InsideWhiteControl |
3133 |
{ |
3134 |
Background = new SolidColorBrush(Colors.Black), |
3135 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3136 |
ControlType = ControlType.InsideWhite |
3137 |
}; |
3138 |
|
3139 |
currentControl.CommentID = Commons.shortGuid(); |
3140 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3141 |
currentControl.IsNew = true; |
3142 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3143 |
|
3144 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3145 |
} |
3146 |
} |
3147 |
} |
3148 |
break; |
3149 |
|
3150 |
case ControlType.OverlapWhite: |
3151 |
{ |
3152 |
if (e.LeftButton == MouseButtonState.Pressed) |
3153 |
{ |
3154 |
if (currentControl is OverlapWhiteControl) |
3155 |
{ |
3156 |
if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3157 |
{ |
3158 |
return; |
3159 |
} |
3160 |
|
3161 |
CreateCommand.Instance.Execute(currentControl); |
3162 |
|
3163 |
currentControl = null; |
3164 |
this.cursor = Cursors.Arrow; |
3165 |
} |
3166 |
else |
3167 |
{ |
3168 |
currentControl = new OverlapWhiteControl |
3169 |
{ |
3170 |
Background = new SolidColorBrush(Colors.Black), |
3171 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3172 |
ControlType = ControlType.OverlapWhite |
3173 |
}; |
3174 |
|
3175 |
currentControl.CommentID = Commons.shortGuid(); |
3176 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3177 |
currentControl.IsNew = true; |
3178 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3179 |
|
3180 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3181 |
} |
3182 |
} |
3183 |
} |
3184 |
break; |
3185 |
|
3186 |
case ControlType.ClipWhite: |
3187 |
{ |
3188 |
if (e.LeftButton == MouseButtonState.Pressed) |
3189 |
{ |
3190 |
if (currentControl is ClipWhiteControl) |
3191 |
{ |
3192 |
if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3193 |
{ |
3194 |
return; |
3195 |
} |
3196 |
|
3197 |
CreateCommand.Instance.Execute(currentControl); |
3198 |
|
3199 |
currentControl = null; |
3200 |
this.cursor = Cursors.Arrow; |
3201 |
} |
3202 |
else |
3203 |
{ |
3204 |
currentControl = new ClipWhiteControl |
3205 |
{ |
3206 |
Background = new SolidColorBrush(Colors.Black), |
3207 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3208 |
ControlType = ControlType.ClipWhite |
3209 |
}; |
3210 |
|
3211 |
currentControl.CommentID = Commons.shortGuid(); |
3212 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3213 |
currentControl.IsNew = true; |
3214 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3215 |
|
3216 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3217 |
} |
3218 |
} |
3219 |
} |
3220 |
break; |
3221 |
|
3222 |
case ControlType.Rectangle: |
3223 |
{ |
3224 |
if (e.LeftButton == MouseButtonState.Pressed) |
3225 |
{ |
3226 |
if (currentControl is RectangleControl) |
3227 |
{ |
3228 |
//20180906 LJY TEST IsRotationDrawingEnable |
3229 |
if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3230 |
{ |
3231 |
return; |
3232 |
} |
3233 |
|
3234 |
CreateCommand.Instance.Execute(currentControl); |
3235 |
currentControl = null; |
3236 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
3237 |
} |
3238 |
else |
3239 |
{ |
3240 |
currentControl = new RectangleControl |
3241 |
{ |
3242 |
Background = new SolidColorBrush(Colors.Black), |
3243 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3244 |
ControlType = ControlType.Rectangle |
3245 |
}; |
3246 |
|
3247 |
currentControl.CommentID = Commons.shortGuid(); |
3248 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3249 |
currentControl.IsNew = true; |
3250 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3251 |
|
3252 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3253 |
} |
3254 |
} |
3255 |
} |
3256 |
break; |
3257 |
|
3258 |
case ControlType.RectCloud: |
3259 |
{ |
3260 |
if (e.LeftButton == MouseButtonState.Pressed) |
3261 |
{ |
3262 |
if (currentControl is RectCloudControl) |
3263 |
{ |
3264 |
//20180906 LJY TEST IsRotationDrawingEnable |
3265 |
if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3266 |
{ |
3267 |
return; |
3268 |
} |
3269 |
|
3270 |
CreateCommand.Instance.Execute(currentControl); |
3271 |
|
3272 |
currentControl = null; |
3273 |
|
3274 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
3275 |
} |
3276 |
else |
3277 |
{ |
3278 |
currentControl = new RectCloudControl |
3279 |
{ |
3280 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3281 |
ControlType = ControlType.RectCloud, |
3282 |
Background = new SolidColorBrush(Colors.Black) |
3283 |
}; |
3284 |
|
3285 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3286 |
currentControl.CommentID = Commons.shortGuid(); |
3287 |
currentControl.IsNew = true; |
3288 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3289 |
} |
3290 |
} |
3291 |
} |
3292 |
break; |
3293 |
|
3294 |
case ControlType.Circle: |
3295 |
{ |
3296 |
if (e.LeftButton == MouseButtonState.Pressed) |
3297 |
{ |
3298 |
if (currentControl is CircleControl) |
3299 |
{ |
3300 |
//20180906 LJY TEST IsRotationDrawingEnable |
3301 |
if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3302 |
{ |
3303 |
return; |
3304 |
} |
3305 |
|
3306 |
CreateCommand.Instance.Execute(currentControl); |
3307 |
|
3308 |
currentControl = null; |
3309 |
} |
3310 |
else |
3311 |
{ |
3312 |
currentControl = new CircleControl |
3313 |
{ |
3314 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3315 |
LeftBottomPoint = this.CanvasDrawingMouseDownPoint, |
3316 |
Background = new SolidColorBrush(Colors.Black) |
3317 |
}; |
3318 |
|
3319 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3320 |
currentControl.CommentID = Commons.shortGuid(); |
3321 |
currentControl.IsNew = true; |
3322 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3323 |
} |
3324 |
} |
3325 |
} |
3326 |
break; |
3327 |
|
3328 |
case ControlType.Triangle: |
3329 |
{ |
3330 |
if (e.LeftButton == MouseButtonState.Pressed) |
3331 |
{ |
3332 |
if (currentControl is TriControl) |
3333 |
{ |
3334 |
var content = currentControl as TriControl; |
3335 |
if (content.MidPoint == new Point(0, 0)) |
3336 |
{ |
3337 |
content.MidPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y); |
3338 |
} |
3339 |
else |
3340 |
{ |
3341 |
//20180906 LJY TEST IsRotationDrawingEnable |
3342 |
if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3343 |
{ |
3344 |
return; |
3345 |
} |
3346 |
|
3347 |
CreateCommand.Instance.Execute(currentControl); |
3348 |
|
3349 |
currentControl = null; |
3350 |
} |
3351 |
} |
3352 |
else |
3353 |
{ |
3354 |
currentControl = new TriControl |
3355 |
{ |
3356 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3357 |
Background = new SolidColorBrush(Colors.Black), |
3358 |
}; |
3359 |
|
3360 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3361 |
currentControl.CommentID = Commons.shortGuid(); |
3362 |
currentControl.IsNew = true; |
3363 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3364 |
} |
3365 |
} |
3366 |
} |
3367 |
break; |
3368 |
|
3369 |
case ControlType.CancelLine: |
3370 |
case ControlType.SingleLine: |
3371 |
case ControlType.ArrowLine: |
3372 |
case ControlType.TwinLine: |
3373 |
case ControlType.DimLine: |
3374 |
{ |
3375 |
if (e.LeftButton == MouseButtonState.Pressed) |
3376 |
{ |
3377 |
if (currentControl is LineControl) |
3378 |
{ |
3379 |
//20180906 LJY TEST IsRotationDrawingEnable |
3380 |
if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3381 |
{ |
3382 |
return; |
3383 |
} |
3384 |
|
3385 |
CreateCommand.Instance.Execute(currentControl); |
3386 |
currentControl = null; |
3387 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
3388 |
} |
3389 |
else |
3390 |
{ |
3391 |
currentControl = new LineControl |
3392 |
{ |
3393 |
ControlType = this.controlType, |
3394 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3395 |
Background = new SolidColorBrush(Colors.Black) |
3396 |
}; |
3397 |
|
3398 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3399 |
currentControl.CommentID = Commons.shortGuid(); |
3400 |
currentControl.IsNew = true; |
3401 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3402 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
3403 |
} |
3404 |
} |
3405 |
} |
3406 |
break; |
3407 |
|
3408 |
case ControlType.PolygonControl: |
3409 |
{ |
3410 |
if (currentControl is PolygonControl) |
3411 |
{ |
3412 |
var control = currentControl as PolygonControl; |
3413 |
|
3414 |
if (e.RightButton == MouseButtonState.Pressed) |
3415 |
{ |
3416 |
control.IsCompleted = true; |
3417 |
} |
3418 |
|
3419 |
if (!control.IsCompleted) |
3420 |
{ |
3421 |
control.PointSet.Add(control.EndPoint); |
3422 |
} |
3423 |
else |
3424 |
{ |
3425 |
//20180906 LJY TEST IsRotationDrawingEnable |
3426 |
if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3427 |
{ |
3428 |
return; |
3429 |
} |
3430 |
|
3431 |
var firstPoint = control.PointSet.First(); |
3432 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
3433 |
control.LineSize = ViewerDataModel.Instance.LineSize; |
3434 |
control.PointSet.Add(firstPoint); |
3435 |
|
3436 |
control.ApplyOverViewData(); |
3437 |
|
3438 |
CreateCommand.Instance.Execute(currentControl); |
3439 |
control.UpdateControl(); |
3440 |
currentControl = null; |
3441 |
} |
3442 |
} |
3443 |
else |
3444 |
{ |
3445 |
if (e.LeftButton == MouseButtonState.Pressed) |
3446 |
{ |
3447 |
currentControl = new PolygonControl |
3448 |
{ |
3449 |
PointSet = new List<Point>(), |
3450 |
}; |
3451 |
|
3452 |
var polygonControl = (currentControl as PolygonControl); |
3453 |
currentControl.CommentID = Commons.shortGuid(); |
3454 |
currentControl.IsNew = true; |
3455 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3456 |
polygonControl.StartPoint = CanvasDrawingMouseDownPoint; |
3457 |
polygonControl.EndPoint = CanvasDrawingMouseDownPoint; |
3458 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3459 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3460 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3461 |
polygonControl.ApplyTemplate(); |
3462 |
polygonControl.Visibility = Visibility.Visible; |
3463 |
} |
3464 |
} |
3465 |
} |
3466 |
break; |
3467 |
|
3468 |
case ControlType.ChainLine: |
3469 |
{ |
3470 |
if (currentControl is PolygonControl) |
3471 |
{ |
3472 |
var control = currentControl as PolygonControl; |
3473 |
|
3474 |
if (e.RightButton == MouseButtonState.Pressed) |
3475 |
{ |
3476 |
//20180906 LJY TEST IsRotationDrawingEnable |
3477 |
if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3478 |
{ |
3479 |
return; |
3480 |
} |
3481 |
|
3482 |
CreateCommand.Instance.Execute(currentControl); |
3483 |
|
3484 |
currentControl = null; |
3485 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
3486 |
return; |
3487 |
} |
3488 |
|
3489 |
if (!control.IsCompleted) |
3490 |
{ |
3491 |
control.PointSet.Add(control.EndPoint); |
3492 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
3493 |
} |
3494 |
} |
3495 |
else |
3496 |
{ |
3497 |
if (e.LeftButton == MouseButtonState.Pressed) |
3498 |
{ |
3499 |
MainAngle.Visibility = Visibility.Visible; |
3500 |
currentControl = new PolygonControl |
3501 |
{ |
3502 |
PointSet = new List<Point>(), |
3503 |
//강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정) |
3504 |
ControlType = ControlType.ChainLine, |
3505 |
DashSize = ViewerDataModel.Instance.DashSize, |
3506 |
LineSize = ViewerDataModel.Instance.LineSize, |
3507 |
//PointC = new StylusPointSet() |
3508 |
}; |
3509 |
|
3510 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3511 |
//{ |
3512 |
var polygonControl = (currentControl as PolygonControl); |
3513 |
currentControl.CommentID = Commons.shortGuid(); |
3514 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3515 |
currentControl.IsNew = true; |
3516 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3517 |
//currentControl.OnApplyTemplate(); |
3518 |
//polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint); |
3519 |
//polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint); |
3520 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3521 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3522 |
//} |
3523 |
} |
3524 |
} |
3525 |
} |
3526 |
break; |
3527 |
|
3528 |
case ControlType.ArcLine: |
3529 |
{ |
3530 |
if (e.LeftButton == MouseButtonState.Pressed) |
3531 |
{ |
3532 |
if (currentControl is ArcControl) |
3533 |
{ |
3534 |
//20180906 LJY TEST IsRotationDrawingEnable |
3535 |
if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3536 |
{ |
3537 |
return; |
3538 |
} |
3539 |
|
3540 |
CreateCommand.Instance.Execute(currentControl); |
3541 |
|
3542 |
currentControl = null; |
3543 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
3544 |
} |
3545 |
else |
3546 |
{ |
3547 |
currentControl = new ArcControl |
3548 |
{ |
3549 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3550 |
Background = new SolidColorBrush(Colors.Black) |
3551 |
}; |
3552 |
currentControl.CommentID = Commons.shortGuid(); |
3553 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3554 |
currentControl.IsNew = true; |
3555 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3556 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
3557 |
} |
3558 |
} |
3559 |
else if (e.RightButton == MouseButtonState.Pressed) |
3560 |
{ |
3561 |
if (currentControl != null) |
3562 |
{ |
3563 |
(currentControl as ArcControl).setClock(); |
3564 |
(currentControl as ArcControl).MidPoint = new Point(0, 0); |
3565 |
} |
3566 |
} |
3567 |
} |
3568 |
break; |
3569 |
|
3570 |
case ControlType.ArcArrow: |
3571 |
{ |
3572 |
if (e.LeftButton == MouseButtonState.Pressed) |
3573 |
{ |
3574 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3575 |
//{ |
3576 |
if (currentControl is ArrowArcControl) |
3577 |
{ |
3578 |
//20180906 LJY TEST IsRotationDrawingEnable |
3579 |
if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3580 |
{ |
3581 |
return; |
3582 |
} |
3583 |
|
3584 |
CreateCommand.Instance.Execute(currentControl); |
3585 |
|
3586 |
currentControl = null; |
3587 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
3588 |
} |
3589 |
else |
3590 |
{ |
3591 |
currentControl = new ArrowArcControl |
3592 |
{ |
3593 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3594 |
Background = new SolidColorBrush(Colors.Black) |
3595 |
}; |
3596 |
currentControl.CommentID = Commons.shortGuid(); |
3597 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3598 |
currentControl.IsNew = true; |
3599 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3600 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
3601 |
} |
3602 |
//} |
3603 |
} |
3604 |
else if (e.RightButton == MouseButtonState.Pressed) |
3605 |
{ |
3606 |
if (currentControl != null) |
3607 |
{ |
3608 |
(currentControl as ArrowArcControl).setClock(); |
3609 |
(currentControl as ArrowArcControl).MiddlePoint = new Point(0, 0); |
3610 |
//(currentControl as ArcControl).ApplyTemplate(); |
3611 |
} |
3612 |
} |
3613 |
} |
3614 |
break; |
3615 |
|
3616 |
case ControlType.ArrowMultiLine: |
3617 |
{ |
3618 |
if (e.LeftButton == MouseButtonState.Pressed) |
3619 |
{ |
3620 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3621 |
//{ |
3622 |
if (currentControl is ArrowControl_Multi) |
3623 |
{ |
3624 |
var content = currentControl as ArrowControl_Multi; |
3625 |
if (content.MiddlePoint == new Point(0, 0)) |
3626 |
{ |
3627 |
if (ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift) |
3628 |
{ |
3629 |
content.MiddlePoint = content.EndPoint; |
3630 |
} |
3631 |
else |
3632 |
{ |
3633 |
content.MiddlePoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y); |
3634 |
} |
3635 |
} |
3636 |
else |
3637 |
{ |
3638 |
//20180906 LJY TEST IsRotationDrawingEnable |
3639 |
if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3640 |
{ |
3641 |
return; |
3642 |
} |
3643 |
|
3644 |
CreateCommand.Instance.Execute(currentControl); |
3645 |
|
3646 |
currentControl = null; |
3647 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
3648 |
} |
3649 |
} |
3650 |
else |
3651 |
{ |
3652 |
currentControl = new ArrowControl_Multi |
3653 |
{ |
3654 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3655 |
Background = new SolidColorBrush(Colors.Black) |
3656 |
}; |
3657 |
currentControl.CommentID = Commons.shortGuid(); |
3658 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3659 |
currentControl.IsNew = true; |
3660 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3661 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
3662 |
} |
3663 |
//} |
3664 |
} |
3665 |
} |
3666 |
break; |
3667 |
|
3668 |
case ControlType.PolygonCloud: |
3669 |
{ |
3670 |
if (currentControl is CloudControl) |
3671 |
{ |
3672 |
var control = currentControl as CloudControl; |
3673 |
if (e.RightButton == MouseButtonState.Pressed) |
3674 |
{ |
3675 |
control.IsCompleted = true; |
3676 |
} |
3677 |
|
3678 |
if (!control.IsCompleted) |
3679 |
{ |
3680 |
control.PointSet.Add(control.EndPoint); |
3681 |
} |
3682 |
else |
3683 |
{ |
3684 |
//20180906 LJY TEST IsRotationDrawingEnable |
3685 |
if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3686 |
{ |
3687 |
return; |
3688 |
} |
3689 |
|
3690 |
CreateCommand.Instance.Execute(currentControl); |
3691 |
|
3692 |
control.isTransOn = true; |
3693 |
var firstPoint = control.PointSet.First(); |
3694 |
|
3695 |
control.PointSet.Add(firstPoint); |
3696 |
control.DrawingCloud(); |
3697 |
control.ApplyOverViewData(); |
3698 |
|
3699 |
currentControl = null; |
3700 |
} |
3701 |
} |
3702 |
else |
3703 |
{ |
3704 |
if (e.LeftButton == MouseButtonState.Pressed) |
3705 |
{ |
3706 |
currentControl = new CloudControl |
3707 |
{ |
3708 |
PointSet = new List<Point>(), |
3709 |
PointC = new StylusPointSet() |
3710 |
}; |
3711 |
|
3712 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3713 |
//{ |
3714 |
var polygonControl = (currentControl as CloudControl); |
3715 |
currentControl.CommentID = Commons.shortGuid(); |
3716 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3717 |
currentControl.IsNew = true; |
3718 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3719 |
|
3720 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3721 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3722 |
|
3723 |
//} |
3724 |
} |
3725 |
} |
3726 |
} |
3727 |
break; |
3728 |
|
3729 |
case ControlType.ImgControl: |
3730 |
{ |
3731 |
if (e.LeftButton == MouseButtonState.Pressed) |
3732 |
{ |
3733 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3734 |
//{ |
3735 |
if (currentControl is ImgControl) |
3736 |
{ |
3737 |
//20180906 LJY TEST IsRotationDrawingEnable |
3738 |
if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3739 |
{ |
3740 |
return; |
3741 |
} |
3742 |
|
3743 |
CreateCommand.Instance.Execute(currentControl); |
3744 |
controlType = ControlType.ImgControl; |
3745 |
currentControl = null; |
3746 |
} |
3747 |
else |
3748 |
{ |
3749 |
string extension = System.IO.Path.GetExtension(filename).ToUpper(); |
3750 |
if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG") |
3751 |
{ |
3752 |
UriBuilder downloadUri = new UriBuilder(App.BaseAddress); |
3753 |
UriBuilder uri = new UriBuilder(filename); |
3754 |
uri.Host = downloadUri.Host; |
3755 |
uri.Port = downloadUri.Port; |
3756 |
|
3757 |
Image img = new Image(); |
3758 |
if (filename.Contains(".svg")) |
3759 |
{ |
3760 |
byte[] imageData = null; |
3761 |
DrawingImage image = null; |
3762 |
using (System.Net.WebClient web = new System.Net.WebClient()) |
3763 |
{ |
3764 |
imageData = web.DownloadData(uri.Uri); |
3765 |
System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
3766 |
image = SvgReader.Load(stream); |
3767 |
} |
3768 |
img.Source = image; |
3769 |
} |
3770 |
else |
3771 |
{ |
3772 |
img.Source = new BitmapImage(uri.Uri); |
3773 |
} |
3774 |
|
3775 |
currentControl = new ImgControl |
3776 |
{ |
3777 |
Background = new SolidColorBrush(Colors.Black), |
3778 |
PointSet = new List<Point>(), |
3779 |
FilePath = uri.Uri.ToString(), |
3780 |
ImageData = img.Source, |
3781 |
StartPoint = CanvasDrawingMouseDownPoint, |
3782 |
EndPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y + 100), |
3783 |
TopRightPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y + 100), |
3784 |
LeftBottomPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y), |
3785 |
ControlType = ControlType.ImgControl |
3786 |
}; |
3787 |
|
3788 |
currentControl.CommentID = Commons.shortGuid(); |
3789 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3790 |
currentControl.IsNew = true; |
3791 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3792 |
|
3793 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3794 |
(currentControl as ImgControl).CommentAngle -= rotate.Angle; |
3795 |
} |
3796 |
} |
3797 |
//} |
3798 |
} |
3799 |
} |
3800 |
break; |
3801 |
|
3802 |
case ControlType.Date: |
3803 |
{ |
3804 |
if (e.LeftButton == MouseButtonState.Pressed) |
3805 |
{ |
3806 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3807 |
//{ |
3808 |
if (currentControl is DateControl) |
3809 |
{ |
3810 |
//20180906 LJY TEST IsRotationDrawingEnable |
3811 |
if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3812 |
{ |
3813 |
return; |
3814 |
} |
3815 |
|
3816 |
CreateCommand.Instance.Execute(currentControl); |
3817 |
currentControl = null; |
3818 |
|
3819 |
if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
3820 |
{ |
3821 |
controlType = ControlType.None; |
3822 |
IsSwingMode = false; |
3823 |
Common.ViewerDataModel.Instance.SelectedControl = ""; |
3824 |
Common.ViewerDataModel.Instance.ControlTag = null; |
3825 |
mouseHandlingMode = MouseHandlingMode.None; |
3826 |
this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false; |
3827 |
txtBatch.Visibility = Visibility.Collapsed; |
3828 |
} |
3829 |
} |
3830 |
else |
3831 |
{ |
3832 |
currentControl = new DateControl |
3833 |
{ |
3834 |
StartPoint = CanvasDrawingMouseDownPoint, |
3835 |
Background = new SolidColorBrush(Colors.Black) |
3836 |
}; |
3837 |
currentControl.CommentID = Commons.shortGuid(); |
3838 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3839 |
currentControl.IsNew = true; |
3840 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3841 |
|
3842 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3843 |
if (currentControl is ImgControl) |
3844 |
{ |
3845 |
(currentControl as ImgControl).CommentAngle -= rotate.Angle; |
3846 |
} |
3847 |
} |
3848 |
//} |
3849 |
} |
3850 |
} |
3851 |
break; |
3852 |
|
3853 |
case ControlType.TextControl: |
3854 |
{ |
3855 |
if (e.LeftButton == MouseButtonState.Pressed) |
3856 |
{ |
3857 |
if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3858 |
{ |
3859 |
currentControl = new TextControl |
3860 |
{ |
3861 |
ControlType = controlType |
3862 |
}; |
3863 |
(currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3864 |
currentControl.CommentID = Commons.shortGuid(); |
3865 |
currentControl.IsNew = true; |
3866 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3867 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3868 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3869 |
|
3870 |
currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X); |
3871 |
currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y); |
3872 |
|
3873 |
(currentControl as TextControl).ControlType_No = 0; |
3874 |
(currentControl as TextControl).CommentAngle -= rotate.Angle; |
3875 |
(currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
3876 |
(currentControl as TextControl).ApplyTemplate(); |
3877 |
(currentControl as TextControl).Base_TextBox.Focus(); |
3878 |
(currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
3879 |
CreateCommand.Instance.Execute(currentControl); |
3880 |
} |
3881 |
} |
3882 |
} |
3883 |
break; |
3884 |
|
3885 |
case ControlType.TextBorder: |
3886 |
{ |
3887 |
if (e.LeftButton == MouseButtonState.Pressed) |
3888 |
{ |
3889 |
if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3890 |
{ |
3891 |
currentControl = new TextControl |
3892 |
{ |
3893 |
ControlType = controlType |
3894 |
}; |
3895 |
|
3896 |
(currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3897 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3898 |
currentControl.CommentID = Commons.shortGuid(); |
3899 |
currentControl.IsNew = true; |
3900 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3901 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3902 |
currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X); |
3903 |
currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y); |
3904 |
|
3905 |
(currentControl as TextControl).ControlType_No = 1; |
3906 |
(currentControl as TextControl).CommentAngle = Ang; |
3907 |
(currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
3908 |
(currentControl as TextControl).ApplyTemplate(); |
3909 |
(currentControl as TextControl).Base_TextBox.Focus(); |
3910 |
(currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
3911 |
CreateCommand.Instance.Execute(currentControl); |
3912 |
} |
3913 |
} |
3914 |
} |
3915 |
break; |
3916 |
|
3917 |
case ControlType.TextCloud: |
3918 |
{ |
3919 |
if (e.LeftButton == MouseButtonState.Pressed) |
3920 |
{ |
3921 |
if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3922 |
{ |
3923 |
currentControl = new TextControl |
3924 |
{ |
3925 |
ControlType = controlType |
3926 |
}; |
3927 |
|
3928 |
(currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3929 |
currentControl.CommentID = Commons.shortGuid(); |
3930 |
currentControl.IsNew = true; |
3931 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3932 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3933 |
|
3934 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3935 |
currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X); |
3936 |
currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y); |
3937 |
|
3938 |
(currentControl as TextControl).CommentAngle = Ang; |
3939 |
(currentControl as TextControl).ControlType_No = 2; |
3940 |
(currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
3941 |
(currentControl as TextControl).ApplyTemplate(); |
3942 |
|
3943 |
(currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
3944 |
|
3945 |
(currentControl as TextControl).Base_TextBox.Focus(); |
3946 |
CreateCommand.Instance.Execute(currentControl); |
3947 |
|
3948 |
//currentControl = null; |
3949 |
} |
3950 |
} |
3951 |
} |
3952 |
break; |
3953 |
|
3954 |
case ControlType.ArrowTextControl: |
3955 |
{ |
3956 |
if (e.LeftButton == MouseButtonState.Pressed) |
3957 |
{ |
3958 |
if (currentControl is ArrowTextControl) |
3959 |
{ |
3960 |
//20180906 LJY TEST IsRotationDrawingEnable |
3961 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3962 |
{ |
3963 |
return; |
3964 |
} |
3965 |
|
3966 |
CreateCommand.Instance.Execute(currentControl); |
3967 |
|
3968 |
try |
3969 |
{ |
3970 |
if(!(currentControl as ArrowTextControl).IsEditingMode) |
3971 |
{ |
3972 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3973 |
} |
3974 |
} |
3975 |
catch (Exception ex) |
3976 |
{ |
3977 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
3978 |
} |
3979 |
|
3980 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
3981 |
(currentControl as ArrowTextControl).EnableEditing = false; |
3982 |
(currentControl as ArrowTextControl).IsNew = false; |
3983 |
currentControl = null; |
3984 |
} |
3985 |
else |
3986 |
{ |
3987 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3988 |
//{ |
3989 |
currentControl = new ArrowTextControl() |
3990 |
{ |
3991 |
PageAngle = ViewerDataModel.Instance.PageAngle |
3992 |
}; |
3993 |
|
3994 |
currentControl.CommentID = Commons.shortGuid(); |
3995 |
currentControl.IsNew = true; |
3996 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3997 |
|
3998 |
try |
3999 |
{ |
4000 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4001 |
} |
4002 |
catch (Exception ex) |
4003 |
{ |
4004 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
4005 |
} |
4006 |
|
4007 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4008 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4009 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4010 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4011 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4012 |
|
4013 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4014 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4015 |
|
4016 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4017 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4018 |
(currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4019 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
4020 |
|
4021 |
//} |
4022 |
} |
4023 |
} |
4024 |
} |
4025 |
break; |
4026 |
|
4027 |
case ControlType.ArrowTransTextControl: |
4028 |
{ |
4029 |
if (e.LeftButton == MouseButtonState.Pressed) |
4030 |
{ |
4031 |
if (currentControl is ArrowTextControl) |
4032 |
{ |
4033 |
//20180906 LJY TEST IsRotationDrawingEnable |
4034 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4035 |
{ |
4036 |
return; |
4037 |
} |
4038 |
|
4039 |
CreateCommand.Instance.Execute(currentControl); |
4040 |
|
4041 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4042 |
|
4043 |
currentControl.IsNew = false; |
4044 |
currentControl = null; |
4045 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
4046 |
} |
4047 |
else |
4048 |
{ |
4049 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4050 |
//{ |
4051 |
currentControl = new ArrowTextControl() |
4052 |
{ |
4053 |
ControlType = ControlType.ArrowTransTextControl, |
4054 |
PageAngle = ViewerDataModel.Instance.PageAngle |
4055 |
}; |
4056 |
currentControl.CommentID = Commons.shortGuid(); |
4057 |
currentControl.IsNew = true; |
4058 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4059 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4060 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4061 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4062 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4063 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4064 |
(currentControl as ArrowTextControl).isFixed = true; |
4065 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4066 |
|
4067 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4068 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4069 |
|
4070 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4071 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4072 |
(currentControl as ArrowTextControl).isTrans = true; |
4073 |
(currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4074 |
} |
4075 |
} |
4076 |
} |
4077 |
break; |
4078 |
|
4079 |
case ControlType.ArrowTextBorderControl: |
4080 |
{ |
4081 |
if (e.LeftButton == MouseButtonState.Pressed) |
4082 |
{ |
4083 |
if (currentControl is ArrowTextControl) |
4084 |
{ |
4085 |
//20180906 LJY TEST IsRotationDrawingEnable |
4086 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4087 |
{ |
4088 |
return; |
4089 |
} |
4090 |
|
4091 |
CreateCommand.Instance.Execute(currentControl); |
4092 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4093 |
currentControl.IsNew = false; |
4094 |
currentControl = null; |
4095 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
4096 |
} |
4097 |
else |
4098 |
{ |
4099 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4100 |
//{ |
4101 |
currentControl = new ArrowTextControl() |
4102 |
{ |
4103 |
ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect, |
4104 |
PageAngle = ViewerDataModel.Instance.PageAngle |
4105 |
}; |
4106 |
currentControl.CommentID = Commons.shortGuid(); |
4107 |
currentControl.IsNew = true; |
4108 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4109 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4110 |
|
4111 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4112 |
|
4113 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4114 |
|
4115 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4116 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4117 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4118 |
(currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4119 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4120 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4121 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4122 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4123 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
4124 |
//} |
4125 |
} |
4126 |
} |
4127 |
} |
4128 |
break; |
4129 |
|
4130 |
case ControlType.ArrowTransTextBorderControl: |
4131 |
{ |
4132 |
if (e.LeftButton == MouseButtonState.Pressed) |
4133 |
{ |
4134 |
if (currentControl is ArrowTextControl) |
4135 |
{ |
4136 |
//20180906 LJY TEST IsRotationDrawingEnable |
4137 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4138 |
{ |
4139 |
return; |
4140 |
} |
4141 |
CreateCommand.Instance.Execute(currentControl); |
4142 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4143 |
currentControl.IsNew = false; |
4144 |
currentControl = null; |
4145 |
|
4146 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
4147 |
} |
4148 |
else |
4149 |
{ |
4150 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4151 |
//{ |
4152 |
currentControl = new ArrowTextControl() |
4153 |
{ |
4154 |
ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect, |
4155 |
ControlType = ControlType.ArrowTransTextBorderControl, |
4156 |
PageAngle = ViewerDataModel.Instance.PageAngle |
4157 |
}; |
4158 |
|
4159 |
currentControl.CommentID = Commons.shortGuid(); |
4160 |
currentControl.IsNew = true; |
4161 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4162 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4163 |
|
4164 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4165 |
|
4166 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4167 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4168 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4169 |
(currentControl as ArrowTextControl).isFixed = true; |
4170 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4171 |
|
4172 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4173 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4174 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4175 |
(currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4176 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4177 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
4178 |
|
4179 |
//20180911 LJY |
4180 |
(currentControl as ArrowTextControl).isTrans = true; |
4181 |
|
4182 |
//} |
4183 |
} |
4184 |
} |
4185 |
} |
4186 |
break; |
4187 |
|
4188 |
case ControlType.ArrowTextCloudControl: |
4189 |
{ |
4190 |
if (e.LeftButton == MouseButtonState.Pressed) |
4191 |
{ |
4192 |
if (currentControl is ArrowTextControl) |
4193 |
{ |
4194 |
//20180906 LJY TEST IsRotationDrawingEnable |
4195 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4196 |
{ |
4197 |
return; |
4198 |
} |
4199 |
CreateCommand.Instance.Execute(currentControl); |
4200 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4201 |
currentControl.IsNew = false; |
4202 |
currentControl = null; |
4203 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
4204 |
} |
4205 |
else |
4206 |
{ |
4207 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4208 |
//{ |
4209 |
currentControl = new ArrowTextControl() |
4210 |
{ |
4211 |
ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud, |
4212 |
PageAngle = ViewerDataModel.Instance.PageAngle, |
4213 |
ControlType = ControlType.ArrowTextCloudControl |
4214 |
}; |
4215 |
currentControl.CommentID = Commons.shortGuid(); |
4216 |
currentControl.IsNew = true; |
4217 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4218 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4219 |
|
4220 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4221 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4222 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4223 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4224 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4225 |
(currentControl as ArrowTextControl).SetFontFamily((this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.SelectedValue as Markus.Fonts.MarkusFont).FontFamily); |
4226 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4227 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4228 |
|
4229 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4230 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4231 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
4232 |
//} |
4233 |
} |
4234 |
} |
4235 |
} |
4236 |
break; |
4237 |
|
4238 |
case ControlType.ArrowTransTextCloudControl: |
4239 |
{ |
4240 |
if (e.LeftButton == MouseButtonState.Pressed) |
4241 |
{ |
4242 |
if (currentControl is ArrowTextControl) |
4243 |
{ |
4244 |
//20180906 LJY TEST IsRotationDrawingEnable |
4245 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4246 |
{ |
4247 |
return; |
4248 |
} |
4249 |
CreateCommand.Instance.Execute(currentControl); |
4250 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4251 |
currentControl.IsNew = false; |
4252 |
currentControl = null; |
4253 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
4254 |
} |
4255 |
else |
4256 |
{ |
4257 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4258 |
//{ |
4259 |
currentControl = new ArrowTextControl() |
4260 |
{ |
4261 |
ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud, |
4262 |
ControlType = ControlType.ArrowTransTextCloudControl, |
4263 |
PageAngle = ViewerDataModel.Instance.PageAngle |
4264 |
}; |
4265 |
currentControl.CommentID = Commons.shortGuid(); |
4266 |
currentControl.IsNew = true; |
4267 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4268 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4269 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4270 |
|
4271 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4272 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4273 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4274 |
(currentControl as ArrowTextControl).isFixed = true; |
4275 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4276 |
|
4277 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4278 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4279 |
(currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4280 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4281 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4282 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
4283 |
|
4284 |
//20180911 LJY |
4285 |
(currentControl as ArrowTextControl).isTrans = true; |
4286 |
//} |
4287 |
} |
4288 |
} |
4289 |
} |
4290 |
break; |
4291 |
//강인구 추가 |
4292 |
case ControlType.Sign: |
4293 |
{ |
4294 |
if (e.LeftButton == MouseButtonState.Pressed) |
4295 |
{ |
4296 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4297 |
//{ |
4298 |
var _sign = await BaseTaskClient.GetSignDataAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID); |
4299 |
|
4300 |
if (_sign == null) |
4301 |
{ |
4302 |
txtBatch.Visibility = Visibility.Collapsed; |
4303 |
mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
4304 |
controlType = ControlType.None; |
4305 |
|
4306 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert"); |
4307 |
this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false; |
4308 |
return; |
4309 |
} |
4310 |
else |
4311 |
{ |
4312 |
if ( Application.Current.Resources.Keys.OfType<string>().Count(x => x == "UserSign") == 0) |
4313 |
{ |
4314 |
Application.Current.Resources.Add("UserSign", _sign); |
4315 |
} |
4316 |
else |
4317 |
{ |
4318 |
Application.Current.Resources["UserSign"] = _sign; |
4319 |
} |
4320 |
} |
4321 |
|
4322 |
if (currentControl is SignControl) |
4323 |
{ |
4324 |
//20180906 LJY TEST IsRotationDrawingEnable |
4325 |
if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4326 |
{ |
4327 |
return; |
4328 |
} |
4329 |
|
4330 |
CreateCommand.Instance.Execute(currentControl); |
4331 |
currentControl = null; |
4332 |
if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
4333 |
{ |
4334 |
txtBatch.Text = "Place Date"; |
4335 |
controlType = ControlType.Date; |
4336 |
} |
4337 |
} |
4338 |
else |
4339 |
{ |
4340 |
currentControl = new SignControl |
4341 |
{ |
4342 |
Background = new SolidColorBrush(Colors.Black), |
4343 |
UserNumber = App.ViewInfo.UserID, |
4344 |
ProjectNO = App.ViewInfo.ProjectNO, |
4345 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4346 |
EndPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4347 |
ControlType = ControlType.Sign |
4348 |
}; |
4349 |
|
4350 |
currentControl.CommentID = Commons.shortGuid(); |
4351 |
currentControl.IsNew = true; |
4352 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4353 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4354 |
|
4355 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4356 |
(currentControl as SignControl).CommentAngle -= rotate.Angle; |
4357 |
} |
4358 |
//} |
4359 |
} |
4360 |
} |
4361 |
break; |
4362 |
|
4363 |
case ControlType.Mark: |
4364 |
{ |
4365 |
if (e.LeftButton == MouseButtonState.Pressed) |
4366 |
{ |
4367 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4368 |
//{ |
4369 |
if (currentControl is RectangleControl) |
4370 |
{ |
4371 |
//20180906 LJY TEST IsRotationDrawingEnable |
4372 |
if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4373 |
{ |
4374 |
return; |
4375 |
} |
4376 |
|
4377 |
CreateCommand.Instance.Execute(currentControl); |
4378 |
(currentControl as RectangleControl).ApplyOverViewData(); |
4379 |
currentControl = null; |
4380 |
|
4381 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
4382 |
|
4383 |
if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
4384 |
{ |
4385 |
txtBatch.Text = "Place Signature"; |
4386 |
controlType = ControlType.Sign; |
4387 |
} |
4388 |
} |
4389 |
else |
4390 |
{ |
4391 |
currentControl = new RectangleControl |
4392 |
{ |
4393 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4394 |
Background = new SolidColorBrush(Colors.Black), |
4395 |
ControlType = ControlType.Mark, |
4396 |
Paint = PaintSet.Fill |
4397 |
}; |
4398 |
|
4399 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4400 |
currentControl.CommentID = Commons.shortGuid(); |
4401 |
currentControl.IsNew = true; |
4402 |
(currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize; |
4403 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4404 |
} |
4405 |
//} |
4406 |
} |
4407 |
} |
4408 |
break; |
4409 |
|
4410 |
case ControlType.Symbol: |
4411 |
{ |
4412 |
if (e.LeftButton == MouseButtonState.Pressed) |
4413 |
{ |
4414 |
if (currentControl is SymControl) |
4415 |
{ |
4416 |
//20180906 LJY TEST IsRotationDrawingEnable |
4417 |
if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4418 |
{ |
4419 |
return; |
4420 |
} |
4421 |
CreateCommand.Instance.Execute(currentControl); |
4422 |
currentControl = null; |
4423 |
|
4424 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
4425 |
} |
4426 |
else |
4427 |
{ |
4428 |
currentControl = new SymControl |
4429 |
{ |
4430 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4431 |
Background = new SolidColorBrush(Colors.Black), |
4432 |
LineSize = ViewerDataModel.Instance.LineSize + 3, |
4433 |
ControlType = ControlType.Symbol |
4434 |
}; |
4435 |
|
4436 |
currentControl.IsNew = true; |
4437 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4438 |
currentControl.CommentID = Commons.shortGuid(); |
4439 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4440 |
|
4441 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4442 |
(currentControl as SymControl).CommentAngle -= rotate.Angle; |
4443 |
} |
4444 |
//} |
4445 |
} |
4446 |
} |
4447 |
break; |
4448 |
|
4449 |
case ControlType.Stamp: |
4450 |
{ |
4451 |
if (e.LeftButton == MouseButtonState.Pressed) |
4452 |
{ |
4453 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4454 |
//{ |
4455 |
if (currentControl is SymControlN) |
4456 |
{ |
4457 |
//20180906 LJY TEST IsRotationDrawingEnable |
4458 |
if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4459 |
{ |
4460 |
return; |
4461 |
} |
4462 |
|
4463 |
CreateCommand.Instance.Execute(currentControl); |
4464 |
currentControl = null; |
4465 |
|
4466 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
4467 |
} |
4468 |
else |
4469 |
{ |
4470 |
currentControl = new SymControlN |
4471 |
{ |
4472 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4473 |
Background = new SolidColorBrush(Colors.Black), |
4474 |
STAMP = App.SystemInfo.STAMP, |
4475 |
STAMP_Contents = App.SystemInfo.STAMP_CONTENTS, |
4476 |
ControlType = ControlType.Stamp |
4477 |
}; |
4478 |
|
4479 |
currentControl.IsNew = true; |
4480 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4481 |
currentControl.CommentID = Commons.shortGuid(); |
4482 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4483 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4484 |
(currentControl as SymControlN).CommentAngle -= rotate.Angle; |
4485 |
} |
4486 |
//} |
4487 |
} |
4488 |
} |
4489 |
break; |
4490 |
|
4491 |
case ControlType.PenControl: |
4492 |
{ |
4493 |
if (inkBoard.Tag.ToString() == "Ink") |
4494 |
{ |
4495 |
inkBoard.IsEnabled = true; |
4496 |
StartNewStroke(CanvasDrawingMouseDownPoint); |
4497 |
} |
4498 |
else if (inkBoard.Tag.ToString() == "EraseByPoint") |
4499 |
{ |
4500 |
RemovePointStroke(CanvasDrawingMouseDownPoint); |
4501 |
} |
4502 |
else if (inkBoard.Tag.ToString() == "EraseByStroke") |
4503 |
{ |
4504 |
RemoveLineStroke(CanvasDrawingMouseDownPoint); |
4505 |
} |
4506 |
IsDrawing = true; |
4507 |
return; |
4508 |
} |
4509 |
default: |
4510 |
if (currentControl != null) |
4511 |
{ |
4512 |
currentControl.CommentID = null; |
4513 |
currentControl.IsNew = false; |
4514 |
} |
4515 |
break; |
4516 |
} |
4517 |
|
4518 |
try |
4519 |
{ |
4520 |
if (currentControl is ITextControl) |
4521 |
{ |
4522 |
var textBox = currentControl.ChildrenOfType<TextBox>().Where(x=> x.Name == "PART_ArrowTextBox" || x.Name == "Base_TextBox" || x.Name == "PART_TextBox"); |
4523 |
|
4524 |
if(textBox.Count() > 0) |
4525 |
{ |
4526 |
Behaviors.SpecialcharRemove specialcharRemove = new Behaviors.SpecialcharRemove(); |
4527 |
specialcharRemove.Attach(textBox.First()); |
4528 |
} |
4529 |
else |
4530 |
{ |
4531 |
|
4532 |
} |
4533 |
|
4534 |
} |
4535 |
} |
4536 |
catch (Exception ex) |
4537 |
{ |
4538 |
System.Diagnostics.Debug.WriteLine(ex); |
4539 |
|
4540 |
} |
4541 |
|
4542 |
if (currentControl is ArrowTextControl) |
4543 |
{ |
4544 |
(currentControl as ArrowTextControl).EditEnded += (snd, evt) => |
4545 |
{ |
4546 |
var control = snd as ArrowTextControl; |
4547 |
|
4548 |
if (string.IsNullOrEmpty(control.ArrowText)) |
4549 |
{ |
4550 |
DeleteCommand.Instance.Execute(new [] { control }); |
4551 |
} |
4552 |
}; |
4553 |
|
4554 |
} |
4555 |
|
4556 |
if (Common.ViewerDataModel.Instance.IsMacroCommand) |
4557 |
{ |
4558 |
if (currentControl == null && mouseHandlingMode == MouseHandlingMode.Drawing) |
4559 |
{ |
4560 |
MacroHelper.MacroAction(); |
4561 |
} |
4562 |
//if (currentControl.ControlType) |
4563 |
//txtBatch.Text = "Draw a TextBox"; |
4564 |
//controlType = ControlType.ArrowTextBorderControl; |
4565 |
} |
4566 |
|
4567 |
//if (currentControl != null) |
4568 |
//{ |
4569 |
// currentControl.PageAngle = pageNavigator.CurrentPage.Angle; |
4570 |
//} |
4571 |
} |
4572 |
if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed) |
4573 |
{ |
4574 |
// MACRO 버튼클릭하여 CLOUD RECT 그린 후 |
4575 |
|
4576 |
|
4577 |
if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0) |
4578 |
{ |
4579 |
bool mouseOff = false; |
4580 |
foreach (var item in SelectLayer.Children) |
4581 |
{ |
4582 |
if (item is AdornerFinal) |
4583 |
{ |
4584 |
var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault(); |
4585 |
if (over != null) |
4586 |
{ |
4587 |
mouseOff = true; |
4588 |
} |
4589 |
} |
4590 |
} |
4591 |
|
4592 |
if (!mouseOff) |
4593 |
{ |
4594 |
SelectionSet.Instance.UnSelect(this); |
4595 |
} |
4596 |
} |
4597 |
zoomAndPanControl.CaptureMouse(); |
4598 |
e.Handled = true; |
4599 |
} |
4600 |
} |
4601 |
|
4602 |
private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e) |
4603 |
{ |
4604 |
///mouseButtonDown = e.ChangedButton; |
4605 |
canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2); |
4606 |
} |
4607 |
|
4608 |
private void RemoveLineStroke(Point P) |
4609 |
{ |
4610 |
var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault(); |
4611 |
if (control != null) |
4612 |
{ |
4613 |
DeleteCommand.Instance.Execute(new List<CommentUserInfo>() { control }); |
4614 |
} |
4615 |
} |
4616 |
|
4617 |
private void RemovePointStroke(Point P) |
4618 |
{ |
4619 |
foreach (Stroke hits in inkBoard.Strokes) |
4620 |
{ |
4621 |
foreach (StylusPoint sty in hits.StylusPoints) |
4622 |
{ |
4623 |
} |
4624 |
if (hits.HitTest(P)) |
4625 |
{ |
4626 |
inkBoard.Strokes.Remove(hits); |
4627 |
return; |
4628 |
} |
4629 |
} |
4630 |
} |
4631 |
|
4632 |
private void StartNewStroke(Point P) |
4633 |
{ |
4634 |
strokePoints = new StylusPointCollection(); |
4635 |
StylusPoint segment1Start = new StylusPoint(P.X, P.Y); |
4636 |
strokePoints.Add(segment1Start); |
4637 |
stroke = new Stroke(strokePoints); |
4638 |
|
4639 |
stroke.DrawingAttributes.Color = Colors.Red; |
4640 |
stroke.DrawingAttributes.Width = 4; |
4641 |
stroke.DrawingAttributes.Height = 4; |
4642 |
|
4643 |
inkBoard.Strokes.Add(stroke); |
4644 |
} |
4645 |
|
4646 |
private async void btnConsolidate_Click(object sender, RoutedEventArgs e) |
4647 |
{ |
4648 |
//SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu); |
4649 |
//// update mylist and gridview |
4650 |
//this.UpdateMyMarkupList(); |
4651 |
|
4652 |
//bool result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this); |
4653 |
|
4654 |
//if (result) |
4655 |
//{ |
4656 |
btnFinalPDF.IsEnabled = false; |
4657 |
btnConsolidate.IsEnabled = false; |
4658 |
await ConsolidationMethod(); |
4659 |
//} |
4660 |
//else |
4661 |
//{ |
4662 |
// MessageBox.Show("오류"); |
4663 |
//} |
4664 |
} |
4665 |
|
4666 |
/// <summary> |
4667 |
/// execute TeamConsolidationCommand |
4668 |
/// </summary> |
4669 |
public void TeamConsolidationMethod2() |
4670 |
{ |
4671 |
if (this.gridViewMarkup.SelectedItems.Count == 0) |
4672 |
{ |
4673 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
4674 |
} |
4675 |
else |
4676 |
{ |
4677 |
|
4678 |
ViewerDataModel.Instance.IsConsolidate = true; |
4679 |
SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
4680 |
// update mylist and gridview |
4681 |
|
4682 |
Common.ViewerDataModel.Instance.SystemMain.dzTopMenu.ExecuteSaveCommandAsync(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
4683 |
//this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
4684 |
ViewerDataModel.Instance.IsConsolidate = false; |
4685 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.UpdateMyMarkupList(); |
4686 |
foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
4687 |
{ |
4688 |
if (!this.userData.DEPARTMENT.Equals(item.Depatment)) |
4689 |
{ |
4690 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert"); |
4691 |
return; |
4692 |
} |
4693 |
} |
4694 |
List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>(); |
4695 |
foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
4696 |
{ |
4697 |
MarkupInfoList.Add(item); |
4698 |
} |
4699 |
|
4700 |
TeamConsolidateCommand.Instance.Execute(MarkupInfoList); |
4701 |
} |
4702 |
} |
4703 |
public async void TeamConsolidationMethod() |
4704 |
{ |
4705 |
bool result = false; |
4706 |
|
4707 |
if (this.gridViewMarkup.SelectedItems.Count == 0) |
4708 |
{ |
4709 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
4710 |
} |
4711 |
else |
4712 |
{ |
4713 |
foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
4714 |
{ |
4715 |
if (!this.userData.DEPARTMENT.Equals(item.Depatment)) |
4716 |
{ |
4717 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert"); |
4718 |
} |
4719 |
} |
4720 |
|
4721 |
var isSave = await this.ParentOfType<MainWindow>().dzTopMenu.SaveEventAsync(); |
4722 |
|
4723 |
if (isSave) |
4724 |
{ |
4725 |
var token = ViewerDataModel.Instance.NewMarkupCancelToken(); |
4726 |
|
4727 |
await MarkupLoadAsync(pageNavigator.CurrentPage.PageNumber, ViewerDataModel.Instance.PageAngle, token); |
4728 |
|
4729 |
List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>(); |
4730 |
foreach (var item in this.gridViewMarkup.SelectedItems) |
4731 |
{ |
4732 |
MySelectItem.Add(item as IKCOM.MarkupInfoItem); |
4733 |
} |
4734 |
|
4735 |
TeamConsolidateCommand.Instance.Execute(MySelectItem); |
4736 |
result = true; |
4737 |
} |
4738 |
} |
4739 |
} |
4740 |
|
4741 |
public async Task<bool> ConsolidationMethod() |
4742 |
{ |
4743 |
bool result = false; |
4744 |
|
4745 |
if (this.gridViewMarkup.SelectedItems.Count == 0) |
4746 |
{ |
4747 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
4748 |
} |
4749 |
else |
4750 |
{ |
4751 |
var isSave = await this.ParentOfType<MainWindow>().dzTopMenu.SaveEventAsync(); |
4752 |
|
4753 |
if (isSave) |
4754 |
{ |
4755 |
var token = ViewerDataModel.Instance.NewMarkupCancelToken(); |
4756 |
await MarkupLoadAsync(pageNavigator.CurrentPage.PageNumber, ViewerDataModel.Instance.PageAngle, token); |
4757 |
|
4758 |
List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>(); |
4759 |
foreach (var item in this.gridViewMarkup.SelectedItems) |
4760 |
{ |
4761 |
MySelectItem.Add(item as IKCOM.MarkupInfoItem); |
4762 |
} |
4763 |
int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text); |
4764 |
|
4765 |
result = await ConsolidateCommand.Instance.ExecuteAsync(MySelectItem, iPageNo); |
4766 |
} |
4767 |
} |
4768 |
|
4769 |
return result; |
4770 |
} |
4771 |
|
4772 |
private void btnConsolidate_Loaded(object sender, RoutedEventArgs e) |
4773 |
{ |
4774 |
if (App.ViewInfo != null) |
4775 |
{ |
4776 |
btnConsolidate = (sender as RadRibbonButton); |
4777 |
if (!App.ViewInfo.NewCommentPermission) |
4778 |
{ |
4779 |
(sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed; |
4780 |
} |
4781 |
} |
4782 |
} |
4783 |
|
4784 |
private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e) |
4785 |
{ |
4786 |
TeamConsolidationMethod(); |
4787 |
} |
4788 |
|
4789 |
private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e) |
4790 |
{ |
4791 |
btnTeamConsolidate = sender as RadRibbonButton; |
4792 |
if (App.ViewInfo != null) |
4793 |
{ |
4794 |
if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
4795 |
{ |
4796 |
if (btnConsolidate != null) |
4797 |
{ |
4798 |
btnConsolidate.Visibility = Visibility.Collapsed; |
4799 |
} |
4800 |
|
4801 |
if (!App.ViewInfo.NewCommentPermission) |
4802 |
{ |
4803 |
btnTeamConsolidate.Visibility = Visibility.Collapsed; |
4804 |
} |
4805 |
} |
4806 |
else |
4807 |
{ |
4808 |
btnTeamConsolidate.Visibility = Visibility.Collapsed; |
4809 |
} |
4810 |
} |
4811 |
} |
4812 |
|
4813 |
private async void FinalPDFEvent(object sender, RoutedEventArgs e) |
4814 |
{ |
4815 |
SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu); |
4816 |
// update mylist and gridview |
4817 |
this.UpdateMyMarkupList(); |
4818 |
|
4819 |
var result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommandAsync(this); |
4820 |
|
4821 |
if(!result) |
4822 |
{ |
4823 |
|
4824 |
} |
4825 |
else |
4826 |
{ |
4827 |
var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
4828 |
|
4829 |
if (item != null) |
4830 |
{ |
4831 |
if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID)) |
4832 |
{ |
4833 |
//Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
4834 |
|
4835 |
BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID); |
4836 |
|
4837 |
ViewerDataModel.Instance.FinalPDFTime = DateTime.Now; |
4838 |
} |
4839 |
else |
4840 |
{ |
4841 |
DialogMessage_Alert("Merged PDF가 수행중입니다", "안내"); |
4842 |
} |
4843 |
} |
4844 |
else |
4845 |
{ |
4846 |
//Consolidate 가 없는 경우 |
4847 |
DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
4848 |
} |
4849 |
} |
4850 |
|
4851 |
} |
4852 |
|
4853 |
private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e) |
4854 |
{ |
4855 |
btnFinalPDF = sender as RadRibbonButton; |
4856 |
if (App.ViewInfo != null) |
4857 |
{ |
4858 |
//btnFinalPDF.IsEnabled = false; |
4859 |
|
4860 |
if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
4861 |
{ |
4862 |
btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
4863 |
if (btnConsolidate != null) |
4864 |
{ |
4865 |
btnConsolidate.Visibility = Visibility.Collapsed; |
4866 |
} |
4867 |
} |
4868 |
} |
4869 |
} |
4870 |
|
4871 |
private async void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e) |
4872 |
{ |
4873 |
//UpdateMyMarkupList(); |
4874 |
|
4875 |
if (this.gridViewMarkup.SelectedItems.Count == 0) |
4876 |
{ |
4877 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
4878 |
} |
4879 |
else |
4880 |
{ |
4881 |
//if ((App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
4882 |
//{ |
4883 |
//컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
4884 |
//ViewerDataModel.Instance.MarkupControls_USER.Remove(ViewerDataModel.Instance.SystemMain.dzMainMenu.currentControl); |
4885 |
//ViewerDataModel.Instance.SystemMain.dzMainMenu.currentControl = null; |
4886 |
|
4887 |
//SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu); |
4888 |
//// update mylist and gridview |
4889 |
//this.UpdateMyMarkupList(); |
4890 |
|
4891 |
//var result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this); |
4892 |
|
4893 |
Mouse.SetCursor(Cursors.Wait); |
4894 |
|
4895 |
bool result = await ConsolidationMethod(); |
4896 |
|
4897 |
//System.Threading.Thread.Sleep(500); |
4898 |
|
4899 |
if (result) |
4900 |
{ |
4901 |
var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID); |
4902 |
|
4903 |
var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
4904 |
if (item2 != null) |
4905 |
{ |
4906 |
if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID)) |
4907 |
{ |
4908 |
//Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
4909 |
|
4910 |
BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID); |
4911 |
BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
4912 |
|
4913 |
ViewerDataModel.Instance.FinalPDFTime = DateTime.Now; |
4914 |
|
4915 |
Mouse.SetCursor(Cursors.Arrow); |
4916 |
} |
4917 |
else |
4918 |
{ |
4919 |
DialogMessage_Alert("Merged PDF가 수행중입니다. 잠시 후 수행가능합니다.", "안내"); |
4920 |
} |
4921 |
} |
4922 |
else |
4923 |
{ |
4924 |
DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
4925 |
} |
4926 |
} |
4927 |
else |
4928 |
{ |
4929 |
DialogMessage_Alert("서버가 원활하지 않습니다. 다시 수행 바랍니다.", "안내"); |
4930 |
} |
4931 |
|
4932 |
Mouse.SetCursor(Cursors.Arrow); |
4933 |
} |
4934 |
} |
4935 |
|
4936 |
private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e) |
4937 |
{ |
4938 |
btnConsolidateFinalPDF = (sender as RadRibbonButton); |
4939 |
#if Hyosung |
4940 |
btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
4941 |
#else |
4942 |
|
4943 |
//btnConsolidateFinalPDF.IsEnabled = false; |
4944 |
|
4945 |
if (App.ViewInfo != null) |
4946 |
{ |
4947 |
if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission) |
4948 |
{ |
4949 |
btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
4950 |
} |
4951 |
} |
4952 |
#endif |
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 |
/* |
6158 |
private void zoomAndPanControl_Drop(object sender, DragEventArgs e) |
6159 |
{ |
6160 |
try |
6161 |
{ |
6162 |
if (e.Data.GetDataPresent(typeof(string))) |
6163 |
{ |
6164 |
this.getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
6165 |
string dragData = e.Data.GetData(typeof(string)) as string; |
6166 |
Move_Symbol(sender, dragData); |
6167 |
} |
6168 |
} |
6169 |
catch (Exception ex) |
6170 |
{ |
6171 |
//Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0); |
6172 |
} |
6173 |
} |
6174 |
*/ |
6175 |
} |
6176 |
|
6177 |
public class testItem |
6178 |
{ |
6179 |
public string Title { get; set; } |
6180 |
} |
6181 |
} |