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