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