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