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