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