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