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