markus / KCOM / Controls / Sample.xaml.cs @ f5c6a3d5
이력 | 보기 | 이력해설 | 다운로드 (57.1 KB)
1 |
using IKCOM; |
---|---|
2 |
using KCOM.Common; |
3 |
using KCOMDataModel.DataModel; |
4 |
using MarkupToPDF.Common; |
5 |
using MarkupToPDF.Controls.Parsing; |
6 |
using System; |
7 |
using System.Collections.Generic; |
8 |
using System.Collections.ObjectModel; |
9 |
using System.ComponentModel; |
10 |
using System.Diagnostics; |
11 |
using System.Linq; |
12 |
using System.Threading; |
13 |
using System.Threading.Tasks; |
14 |
using System.Windows; |
15 |
using System.Windows.Controls; |
16 |
using System.Windows.Data; |
17 |
using System.Windows.Input; |
18 |
using System.Windows.Media; |
19 |
using Telerik.Windows.Controls; |
20 |
using static MarkupToPDF.Controls.Parsing.MarkupParser; |
21 |
|
22 |
namespace KCOM.Controls |
23 |
{ |
24 |
/// <summary> |
25 |
/// Interaction logic for PageNavigator.xaml |
26 |
/// </summary> |
27 |
public partial class Sample : UserControl, INotifyPropertyChanged |
28 |
{ |
29 |
public List<FAVORITE_DOC> _FavoriteSet { get; set; } |
30 |
public event PropertyChangedEventHandler PropertyChanged; |
31 |
|
32 |
//PageManager.PageStorage samplePageStorage; |
33 |
|
34 |
public Sample() |
35 |
{ |
36 |
InitializeComponent(); |
37 |
|
38 |
if (App.IsDesignMode) |
39 |
{ |
40 |
return; |
41 |
} |
42 |
|
43 |
//App.splashString(ISplashMessage.SAMPLE); |
44 |
this.Loaded += Sample_Loaded; |
45 |
this.Unloaded += Sample_Unloaded; |
46 |
} |
47 |
|
48 |
private void Sample_Unloaded(object sender, RoutedEventArgs e) |
49 |
{ |
50 |
|
51 |
} |
52 |
|
53 |
private void Sample_Loaded(object sender, RoutedEventArgs e) |
54 |
{ |
55 |
if(!_Initialize) |
56 |
{ |
57 |
_Initialize = true; |
58 |
this.SizeChanged += Sample_SizeChanged; |
59 |
this.lstSelectComment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(lstSelectComment_SelectionChanged); |
60 |
this.ImgListbox.SelectionChanged += new SelectionChangedEventHandler(ImgListbox_SelectionChanged); |
61 |
} |
62 |
} |
63 |
|
64 |
private void Sample_SizeChanged(object sender, SizeChangedEventArgs e) |
65 |
{ |
66 |
if(e.WidthChanged) |
67 |
{ |
68 |
ImgListbox.UpdateLayout(); |
69 |
} |
70 |
} |
71 |
|
72 |
public static readonly DependencyProperty FilteredThumbnailProperty = DependencyProperty.Register("FilteredThumbnail", typeof(CollectionViewSource),typeof(Sample)); |
73 |
public CollectionViewSource FilteredThumbnail |
74 |
{ |
75 |
get { return (CollectionViewSource)GetValue(FilteredThumbnailProperty); } |
76 |
set { SetValue(FilteredThumbnailProperty, value); } |
77 |
} |
78 |
|
79 |
public static readonly DependencyProperty CurrentPageProperty |
80 |
= DependencyProperty.Register("CurrentPage", typeof(ThumbnailItem), typeof(Sample),new PropertyMetadata(null,CurrentPageChnaged)); |
81 |
|
82 |
private static void CurrentPageChnaged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
83 |
{ |
84 |
//var owner = d as Sample; |
85 |
|
86 |
//if (owner?.UsersCommentPagesList != null) |
87 |
//{ |
88 |
// owner.SetCommentPages(); |
89 |
//} |
90 |
} |
91 |
|
92 |
public ThumbnailItem CurrentPage |
93 |
{ |
94 |
get { return (ThumbnailItem)GetValue(CurrentPageProperty); } |
95 |
set { SetValue(CurrentPageProperty, value); } |
96 |
} |
97 |
|
98 |
public ObservableCollection<ThumbnailItem> _thumbnailItems; |
99 |
private List<DOCPAGE> _PageList = null; |
100 |
private string _DefaultUri = null; |
101 |
public int PageCount = 0; |
102 |
private bool _Initialize; |
103 |
|
104 |
public event EventHandler<EventArgs> ThumbInitialized; |
105 |
public event EventHandler<PageChangeEventArgs> PageChanged; |
106 |
public event EventHandler<PageChangeEventArgs> PageChanging; |
107 |
|
108 |
private List<UsersCommentPagesMember> _UsersCommentPagesList; |
109 |
|
110 |
public List<UsersCommentPagesMember> UsersCommentPagesList |
111 |
{ |
112 |
get { |
113 |
if(_UsersCommentPagesList == null) |
114 |
{ |
115 |
_UsersCommentPagesList = new List<UsersCommentPagesMember>(); |
116 |
} |
117 |
|
118 |
return _UsersCommentPagesList; } |
119 |
set { _UsersCommentPagesList = value; } |
120 |
} |
121 |
|
122 |
public class PageChangeEventArgs : EventArgs |
123 |
{ |
124 |
public DOCPAGE CurrentPage { get; set; } |
125 |
public string PageUri { get; set; } |
126 |
public int PageNumber { get; set; } |
127 |
} |
128 |
private bool _IsFitOn { get; set; } |
129 |
public bool IsFitOn |
130 |
{ |
131 |
get |
132 |
{ |
133 |
return _IsFitOn; |
134 |
} |
135 |
set |
136 |
{ |
137 |
_IsFitOn = value; |
138 |
RaisePropertyChanged("IsFitOn"); |
139 |
} |
140 |
} |
141 |
|
142 |
public void RaisePropertyChanged(string propName) |
143 |
{ |
144 |
if (PropertyChanged != null) |
145 |
PropertyChanged(this, new PropertyChangedEventArgs(propName)); |
146 |
} |
147 |
|
148 |
public async Task SetPageNaviAsync(List<DOCPAGE> PageList, string DefaultUri) |
149 |
{ |
150 |
//rdoAllPages.Checked += new RoutedEventHandler(rdoCommented_Checked); |
151 |
//rdoFavoritePages.Checked += new RoutedEventHandler(rdoFavoritePages_Checked); |
152 |
|
153 |
this._PageList = PageList; |
154 |
this._DefaultUri = DefaultUri; |
155 |
|
156 |
string tempStoragePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "MARKUS", System.IO.Path.GetRandomFileName()); |
157 |
|
158 |
//samplePageStorage = new PageManager.PageStorage(_DefaultUri, tempStoragePath,"jpg", _PageList.Count(), _PageList.Count()); |
159 |
|
160 |
await this.Dispatcher.InvokeAsync(()=> ThumbnailSetAsync()); |
161 |
|
162 |
this.PageCount = PageList.Count(); |
163 |
|
164 |
//ThumbNmailSet(); |
165 |
|
166 |
} |
167 |
|
168 |
void rdoCommented_Checked(object sender, RoutedEventArgs e) |
169 |
{ |
170 |
Logger.sendCheckLog("rdoCommented_Checked", 1); |
171 |
SetCommentPages(); |
172 |
} |
173 |
|
174 |
void rdoFavoritePages_Checked(object sender, RoutedEventArgs e) |
175 |
{ |
176 |
Logger.sendCheckLog("rdoFavoritePages_Checked", 1); |
177 |
//if (rdoFavoritePages.IsChecked == true) |
178 |
// expCommentPages.IsExpanded = false; |
179 |
|
180 |
//_FavoriteSet = _FavoriteSet == null ? new List<FAVORITE_DOC>() : _FavoriteSet; |
181 |
//if (_FavoriteSet.Count > 0) |
182 |
//{ |
183 |
// SetCommentPages(); //수정 |
184 |
//} |
185 |
//else |
186 |
//{ |
187 |
// rdoAllPages.IsChecked = true; |
188 |
// rdoFavoritePages.IsChecked = false; |
189 |
//} |
190 |
} |
191 |
|
192 |
private async void ShowPageChange(object sender, RoutedEventArgs e) |
193 |
{ |
194 |
if (_Initialize) |
195 |
{ |
196 |
//if (rdoAllPages.IsChecked == true) expCommentPages.IsExpanded = false; |
197 |
await this.Dispatcher.InvokeAsync(() => ThumbnailSetAsync()); |
198 |
} |
199 |
} |
200 |
|
201 |
void expCommentPages_PreviewCollapsed(object sender, Telerik.Windows.RadRoutedEventArgs e) |
202 |
{ |
203 |
//txtThumbCount.Visibility = Visibility.Collapsed; |
204 |
} |
205 |
|
206 |
void expCommentPages_PreviewExpanded(object sender, Telerik.Windows.RadRoutedEventArgs e) |
207 |
{ |
208 |
Logger.sendCheckLog("expCommentPages_PreviewExpanded", 1); |
209 |
rdoAllPages.IsChecked = false; |
210 |
rdoFavoritePages.IsChecked = false; |
211 |
//txtThumbCount.Visibility = Visibility.Visible; |
212 |
SetCommentPages(); |
213 |
} |
214 |
|
215 |
/// <summary> |
216 |
/// called when image list box's selection is changed |
217 |
/// </summary> |
218 |
/// <param name="sender"></param> |
219 |
/// <param name="e"></param> |
220 |
private async void ImgListbox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) |
221 |
{ |
222 |
if(e.AddedItems.Count > 0) |
223 |
{ |
224 |
await ImgListbox.Dispatcher.InvokeAsync(() => |
225 |
{ |
226 |
var number = (e.AddedItems[0] as KCOM.Common.ThumbnailItem).PageNumber; |
227 |
|
228 |
ViewerDataModel.Instance.SystemMain.dzTopMenu._SaveEvent(null, null); /// save controls |
229 |
|
230 |
this.CurrentPage = e.AddedItems[0] as KCOM.Common.ThumbnailItem; |
231 |
|
232 |
PageChanging(this, new PageChangeEventArgs |
233 |
{ |
234 |
CurrentPage = this._PageList.Where(p => p.PAGE_NUMBER == number).First(), |
235 |
PageNumber = number, |
236 |
PageUri = null |
237 |
}); |
238 |
|
239 |
}); |
240 |
} |
241 |
|
242 |
|
243 |
//if (ImgListbox.SelectedItem != null) |
244 |
//{ |
245 |
// int _CurrentPageNo = -1; |
246 |
// if (this.CurrentPage != null) |
247 |
// { |
248 |
// ViewerDataModel.Instance.SystemMain.dzTopMenu._SaveEvent(null, null); /// save controls |
249 |
|
250 |
// _CurrentPageNo = this.CurrentPage.PageNumber; |
251 |
// } |
252 |
|
253 |
// this.CurrentPage = ImgListbox.SelectedItem as ThumbnailItem; |
254 |
// int iPageNo = this.CurrentPage.PageNumber; |
255 |
// if(_CurrentPageNo != iPageNo) |
256 |
// { |
257 |
// PageChanging(this, new PageChangeEventArgs |
258 |
// { |
259 |
// CurrentPage = this._PageList.Where(p => p.PAGE_NUMBER == iPageNo).First(), |
260 |
// PageNumber = iPageNo, |
261 |
// PageUri = null |
262 |
// }); |
263 |
// } |
264 |
//} |
265 |
|
266 |
//var border = VisualTreeHelper.GetChild(ImgListbox, 0); |
267 |
//if (border != null) |
268 |
//{ |
269 |
// IEnumerable<ScrollViewer> scrollViewer = border.ChildrenOfType<ScrollViewer>(); |
270 |
|
271 |
//} |
272 |
//ScrollViewer scrollViewer = (sender as RadListBox) as ScrollViewer; |
273 |
|
274 |
|
275 |
//System.Diagnostics.Debug.WriteLine("page:"+ImgListbox.SelectedIndex); |
276 |
} |
277 |
|
278 |
public bool GotoPageFlag = false; |
279 |
|
280 |
/// <summary> |
281 |
/// 해당 썸네일로 이동 |
282 |
/// </summary> |
283 |
/// <param name="_pageNumber">이동할 페이지 번호</param> |
284 |
public void GotoPage(int _pageNumber) |
285 |
{ |
286 |
try |
287 |
{ |
288 |
System.Threading.Tasks.Task.Factory.StartNew(() => { |
289 |
|
290 |
var _page = _thumbnailItems.Where(item => item.PageNumber == _pageNumber); |
291 |
if (_page.Count() > 0) |
292 |
{ |
293 |
ThumbnailItem thumbnailitem = _page.First(); |
294 |
if (PageChanging != null) |
295 |
{ |
296 |
|
297 |
ImgListbox.Dispatcher.InvokeAsync(() => { |
298 |
var _itemIndex = this._thumbnailItems.IndexOf(thumbnailitem); |
299 |
ImgListbox.SelectedItem = thumbnailitem; |
300 |
}); |
301 |
//ImgListbox.Items.MoveCurrentTo(thumbnailitem); |
302 |
//if (_itemIndex < _thumbnailItems.Count() - 1) |
303 |
// ImgListbox.ScrollIntoView(_itemIndex); |
304 |
//else |
305 |
// ImgListbox.ScrollIntoView(this._thumbnailItems.Count() - 1); |
306 |
} |
307 |
} |
308 |
|
309 |
}).ConfigureAwait(true); |
310 |
} |
311 |
catch(Exception ex) |
312 |
{ |
313 |
Logger.sendResLog("GotoPage", ex.Message, 0); |
314 |
} |
315 |
} |
316 |
|
317 |
/// <summary> |
318 |
/// 주어진 페이지로 변경한다 |
319 |
/// </summary> |
320 |
/// <param name="iPageNo">변경할 페이지 번호</param> |
321 |
public void ChangePage(int iPageNo) |
322 |
{ |
323 |
var thumbitem = this._thumbnailItems.Where(item => item.PageNumber == iPageNo).FirstOrDefault(); |
324 |
if ((PageChanged != null) && (thumbitem != null)) |
325 |
{ |
326 |
var uri = thumbitem.PageUri.ToString(); |
327 |
//_DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString()); |
328 |
|
329 |
var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber).FirstOrDefault(); |
330 |
if (_DocPages != null) |
331 |
{ |
332 |
PageChanged(this, new PageChangeEventArgs |
333 |
{ |
334 |
CurrentPage = _DocPages, |
335 |
PageUri = uri, |
336 |
PageNumber = thumbitem.PageNumber |
337 |
}); |
338 |
//ImgListbox.SelectedItem = thumbitem; |
339 |
//ImgListbox.Items.MoveCurrentTo(thumbitem); |
340 |
|
341 |
this.CurrentPage = thumbitem; |
342 |
} |
343 |
else |
344 |
{ |
345 |
//System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다"); |
346 |
} |
347 |
} |
348 |
} |
349 |
|
350 |
public void GotoPageTALK(int _pageNumber, int _angle) |
351 |
{ |
352 |
int _PageNo = -1; |
353 |
|
354 |
if (int.TryParse(_pageNumber.ToString(), out _PageNo)) |
355 |
{ |
356 |
var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo); |
357 |
if (_page.Count() > 0) |
358 |
{ |
359 |
ThumbnailItem _item = _page.First(); |
360 |
setPageChangeTALK(_item, _angle); |
361 |
this.ImgListbox.SelectedIndex = _pageNumber - 1; |
362 |
//this.ImgListbox.ScrollIntoView(_pageNumber - 1); |
363 |
} |
364 |
} |
365 |
} |
366 |
|
367 |
public void setPageChangeTALK(ThumbnailItem thumbnailItem, int _angle) |
368 |
{ |
369 |
if (thumbnailItem != null) |
370 |
{ |
371 |
if (PageChanging != null) |
372 |
{ |
373 |
///this.CurrentPage = _NextPage; |
374 |
///_NextPage = thumbnailItem; |
375 |
PageChanging(this, new PageChangeEventArgs |
376 |
{ |
377 |
CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(), |
378 |
PageNumber = Convert.ToInt32(thumbnailItem.PageNumber), |
379 |
PageUri = null |
380 |
}); |
381 |
|
382 |
var instanceMain = this.ParentOfType<MainWindow>(); |
383 |
|
384 |
var rotationNum = (_angle - instanceMain.dzMainMenu.rotate.Angle) / 90; |
385 |
|
386 |
if (rotationNum > 0) // 1, 2, 3 |
387 |
{ |
388 |
for (int i = 0; i < rotationNum; i++) |
389 |
{ |
390 |
drawingPannelRotate(true); |
391 |
} |
392 |
} |
393 |
else if (rotationNum < 0)// -1, -2, -3 |
394 |
{ |
395 |
for (int i = 0; i < -rotationNum; i++) |
396 |
{ |
397 |
drawingPannelRotate(false); |
398 |
} |
399 |
} |
400 |
} |
401 |
} |
402 |
} |
403 |
|
404 |
public void drawingPannelRotate(bool Flag) |
405 |
{ |
406 |
var instanceMain = this.ParentOfType<MainWindow>(); |
407 |
|
408 |
if (Flag) |
409 |
{ |
410 |
if (instanceMain.dzMainMenu.rotate.Angle == 270) |
411 |
{ |
412 |
instanceMain.dzMainMenu.rotate.Angle = 0; |
413 |
} |
414 |
else |
415 |
{ |
416 |
instanceMain.dzMainMenu.rotate.Angle += 90; |
417 |
} |
418 |
} |
419 |
else |
420 |
{ |
421 |
if (instanceMain.dzMainMenu.rotate.Angle == 0) |
422 |
{ |
423 |
instanceMain.dzMainMenu.rotate.Angle = 270; |
424 |
} |
425 |
else |
426 |
{ |
427 |
instanceMain.dzMainMenu.rotate.Angle -= 90; |
428 |
} |
429 |
} |
430 |
|
431 |
if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth) |
432 |
{ |
433 |
double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
434 |
instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
435 |
instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize; |
436 |
} |
437 |
|
438 |
if (instanceMain.dzMainMenu.rotate.Angle == 0) |
439 |
{ |
440 |
instanceMain.dzMainMenu.translate.X = 0; |
441 |
instanceMain.dzMainMenu.translate.Y = 0; |
442 |
} |
443 |
else if (instanceMain.dzMainMenu.rotate.Angle == 90) |
444 |
{ |
445 |
instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
446 |
instanceMain.dzMainMenu.translate.Y = 0; |
447 |
} |
448 |
else if (instanceMain.dzMainMenu.rotate.Angle == 180) |
449 |
{ |
450 |
instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
451 |
instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
452 |
} |
453 |
else |
454 |
{ |
455 |
instanceMain.dzMainMenu.translate.X = 0; |
456 |
instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
457 |
} |
458 |
|
459 |
instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle; |
460 |
ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
461 |
ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
462 |
ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X; |
463 |
ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y; |
464 |
ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle; |
465 |
|
466 |
instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data => |
467 |
{ |
468 |
data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString()); |
469 |
|
470 |
//instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems; |
471 |
var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault(); |
472 |
instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString()); |
473 |
|
474 |
var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault(); |
475 |
if (rotationdoc != null) |
476 |
{ |
477 |
rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE; |
478 |
} |
479 |
else |
480 |
{ |
481 |
ViewerDataModel.Instance.RotationDocs.Add(instance); |
482 |
} |
483 |
instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber); |
484 |
}); |
485 |
} |
486 |
|
487 |
void lstSelectComment_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) |
488 |
{ |
489 |
SetCommentPages(); |
490 |
} |
491 |
|
492 |
void user_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
493 |
{ |
494 |
SetCommentPages(); |
495 |
//System.Diagnostics.Debug.WriteLine(e.PropertyName); |
496 |
} |
497 |
|
498 |
public async void SetCommentPages() |
499 |
{ |
500 |
await this.Dispatcher.InvokeAsync(() => ThumbnailSetAsync()); |
501 |
} |
502 |
|
503 |
public void SetCommentList(List<UsersCommentPagesMember> UsersCommentPagesList) |
504 |
{ |
505 |
Logger.sendCheckLog("SetCommentList", 1); |
506 |
Logger.sendCheckLog("SetCommentList_기존 Comment 색상 제거", 1); |
507 |
#region 기존 색상 제거 작업 |
508 |
|
509 |
foreach (var item in this._thumbnailItems) |
510 |
{ |
511 |
if (item.DisplayColorItems != null) |
512 |
{ |
513 |
item.DisplayColorItems.Clear(); |
514 |
} |
515 |
} |
516 |
#endregion |
517 |
|
518 |
Logger.sendCheckLog("SetCommentList_delItem select 및 remove", 1); |
519 |
List<UsersCommentPagesMember> _delItem = new List<UsersCommentPagesMember>(); |
520 |
|
521 |
this.UsersCommentPagesList.ToList().ForEach(item => |
522 |
{ |
523 |
var _comm = UsersCommentPagesList.Where(a => a.MarkupInfoID == item.MarkupInfoID); |
524 |
|
525 |
if (_comm.Count() == 0) |
526 |
{ |
527 |
_delItem.Add(item); |
528 |
} |
529 |
}); |
530 |
|
531 |
_delItem.ForEach(f => this.UsersCommentPagesList.Remove(f)); |
532 |
|
533 |
Logger.sendCheckLog("SetCommentList_UsersCommentPagesMember_PropertyChanged", 1); |
534 |
List<SetColorMarkupItem> setColorMarkupItems = new List<SetColorMarkupItem>(); |
535 |
|
536 |
UsersCommentPagesList.ForEach(user => |
537 |
{ |
538 |
user.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged); |
539 |
user.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged); |
540 |
|
541 |
var _commLst = this.UsersCommentPagesList.Where(o => o.MarkupInfoID == user.MarkupInfoID); |
542 |
|
543 |
if (_commLst.Count() == 0) |
544 |
{ |
545 |
this.UsersCommentPagesList.Add(user); |
546 |
} |
547 |
else |
548 |
{ |
549 |
if (_commLst.First().PageNumber != user.PageNumber) |
550 |
_commLst.First().PageNumber = user.PageNumber; |
551 |
} |
552 |
|
553 |
user.PageNumber.ForEach(page => |
554 |
{ |
555 |
var _items = this._thumbnailItems.Where(item => item.PageNumber == page); |
556 |
|
557 |
if (_items.Count() > 0) |
558 |
{ |
559 |
setColorMarkupItems.Add(new SetColorMarkupItem { DisplayColor = user.SetColor, markupID = user.MarkupInfoID, Page = page }); |
560 |
|
561 |
} |
562 |
|
563 |
}); |
564 |
}); |
565 |
|
566 |
foreach (var item in this._thumbnailItems) |
567 |
{ |
568 |
item.DisplayColorItems = setColorMarkupItems.Where(color => color.Page == item.PageNumber).ToList(); |
569 |
} |
570 |
|
571 |
Logger.sendCheckLog("SetCommentList_SelectComment.ItemsSource 설정", 1); |
572 |
var data = UsersCommentPagesList.OrderByDescending(p => p.isConSolidation == Convert.ToInt32(true)).ToList(); |
573 |
if (data.Count() != 0) |
574 |
{ |
575 |
if (Convert.ToBoolean(data.First().isConSolidation)) |
576 |
{ |
577 |
data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().UserName = "Consolidated"; |
578 |
data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().Depart = ""; |
579 |
this.lstSelectComment.ItemsSource = data; |
580 |
} |
581 |
else |
582 |
{ |
583 |
this.lstSelectComment.ItemsSource = this.UsersCommentPagesList; //섬네일 |
584 |
} |
585 |
} |
586 |
else |
587 |
{ |
588 |
this.lstSelectComment.ItemsSource = this.UsersCommentPagesList; //섬네일 |
589 |
} |
590 |
|
591 |
Logger.sendCheckLog("SetComme6ntList_ImgListbox 설정", 1); |
592 |
|
593 |
|
594 |
//var template = this.ImgListbox.ItemTemplate; |
595 |
//this.ImgListbox.ItemTemplate = null; |
596 |
//this.ImgListbox.ItemTemplate = template; |
597 |
|
598 |
} |
599 |
|
600 |
List<int> FilterPages = null; |
601 |
|
602 |
private void ThumbnailSetAsync() |
603 |
{ |
604 |
Logger.sendCheckLog("ThumbnailSet", 1); |
605 |
|
606 |
if (FilteredThumbnail == null) |
607 |
{ |
608 |
var uri = _DefaultUri.Replace("{0}/{1}_{2}", "8/0_0"); |
609 |
|
610 |
var pageList = ViewerDataModel.Instance.Document_Info; |
611 |
|
612 |
var items = from page in pageList |
613 |
let pageLink = uri.Replace("{PageNo}", page.PAGE_NUMBER.ToString()) |
614 |
orderby page.PAGE_NUMBER |
615 |
select new ThumbnailItem |
616 |
{ |
617 |
ImageUri = new Uri(pageLink), |
618 |
PageUri = new Uri(pageLink.Replace("jpg", "png")), |
619 |
PageNumber = page.PAGE_NUMBER, |
620 |
Angle = page.PAGE_ANGLE |
621 |
}; |
622 |
|
623 |
_thumbnailItems = new ObservableCollection<ThumbnailItem>(items); |
624 |
FilteredThumbnail = new CollectionViewSource(); |
625 |
FilteredThumbnail.Source = _thumbnailItems; |
626 |
|
627 |
FilterPages = _thumbnailItems.Select(x=>x.PageNumber).ToList(); |
628 |
|
629 |
FilteredThumbnail.Filter += (snd,evt) => |
630 |
{ |
631 |
if (FilterPages?.Count() > 0 && evt.Item != null) |
632 |
{ |
633 |
evt.Accepted = FilterPages.Contains((evt.Item as ThumbnailItem).PageNumber); |
634 |
} |
635 |
else |
636 |
{ |
637 |
evt.Accepted = false; |
638 |
} |
639 |
}; |
640 |
|
641 |
} |
642 |
|
643 |
FilterPages.Clear(); |
644 |
|
645 |
|
646 |
if (rdoAllPages.IsChecked == true) |
647 |
{ |
648 |
FilterPages = _thumbnailItems.Select(x=>x.PageNumber).ToList(); |
649 |
} |
650 |
else if (rdoFavoritePages.IsChecked == true) |
651 |
{ |
652 |
if (_FavoriteSet != null) |
653 |
{ |
654 |
FilterPages = (from thumb in _thumbnailItems |
655 |
where _FavoriteSet.Where(data => data.PAGE_NO == thumb.PageNumber).FirstOrDefault() != null |
656 |
select thumb.PageNumber).ToList(); |
657 |
} |
658 |
} |
659 |
else if (rdoCommentPages.IsChecked == true) |
660 |
{ |
661 |
if (this.lstSelectComment.ItemsSource != null) |
662 |
{ |
663 |
var commentPages = (from commentPage in this.UsersCommentPagesList |
664 |
where commentPage.IsSelected == true |
665 |
select commentPage.PageNumber).SelectMany(x => x).Distinct(); |
666 |
|
667 |
if (commentPages?.Count() > 0) |
668 |
{ |
669 |
FilterPages = (from thumb in _thumbnailItems |
670 |
where commentPages.Where(s => s == thumb.PageNumber).Count() > 0 |
671 |
select thumb.PageNumber).ToList(); |
672 |
} |
673 |
} |
674 |
} |
675 |
|
676 |
if (FilterPages != null) |
677 |
{ |
678 |
FilteredThumbnail.View.Refresh(); |
679 |
|
680 |
if (FilterPages.Count() > 0) |
681 |
{ |
682 |
ImgListbox.SelectedItem = _thumbnailItems.Where(x=>x.PageNumber == FilterPages.FirstOrDefault()).FirstOrDefault(); |
683 |
//SetCommentList(UsersCommentPagesList.ToList()); |
684 |
} |
685 |
else |
686 |
{ |
687 |
ImgListbox.SelectedItem = null; |
688 |
} |
689 |
|
690 |
if (ThumbInitialized != null) |
691 |
{ |
692 |
ThumbInitialized(this, new EventArgs()); |
693 |
ThumbInitialized = null; |
694 |
} |
695 |
} |
696 |
} |
697 |
|
698 |
private async void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
699 |
{ |
700 |
if (e.ClickCount >= 2) |
701 |
{ |
702 |
var selectItem = MarkupList.SelectedItem as IKCOM.MarkupItem; |
703 |
|
704 |
GotoPage(selectItem.PageNumber); |
705 |
|
706 |
var result = await MarkupParser.GetBaseControlAsync(selectItem.Data); |
707 |
|
708 |
Rect rect = new Rect(new Point(result.StartPoint.X - 100, result.StartPoint.Y - 100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100)); |
709 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
710 |
//bool isGO = false; |
711 |
|
712 |
//var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer; |
713 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit; |
714 |
//imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle; |
715 |
//imageViewer.InteractiveUserRectangle += (sen, ea) => |
716 |
//{ |
717 |
// System.Diagnostics.Debug.WriteLine(ea.Bounds); |
718 |
// if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End) |
719 |
// { |
720 |
// this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds); |
721 |
// } |
722 |
|
723 |
//}; |
724 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal; |
725 |
|
726 |
//GotoPage(MarkupList.SelectedItem as MarkupList) |
727 |
} |
728 |
} |
729 |
|
730 |
public class MarkupInfoItemSmall |
731 |
{ |
732 |
public string Id { get; set; } |
733 |
public string UserName { get; set; } |
734 |
public string UserID { get; set; } |
735 |
public int PageNumber { get; set; } |
736 |
public string Data { get; set; } |
737 |
public int Data_Type { get; set; } |
738 |
public bool IsConsolidate { get; set; } |
739 |
} |
740 |
|
741 |
private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; } |
742 |
public List<MarkupInfoItemSmall> MarkupInfoSmallList |
743 |
{ |
744 |
get |
745 |
{ |
746 |
if (_MarkupInfoSmallList == null) |
747 |
{ |
748 |
_MarkupInfoSmallList = new List<MarkupInfoItemSmall>(); |
749 |
} |
750 |
return _MarkupInfoSmallList; |
751 |
} |
752 |
set |
753 |
{ |
754 |
|
755 |
_MarkupInfoSmallList = value; |
756 |
RaisePropertyChanged("MarkupInfoSmallList"); |
757 |
} |
758 |
} |
759 |
|
760 |
/// <summary> |
761 |
/// goto page and select item selected by user |
762 |
/// </summary> |
763 |
/// <param name="sender"></param> |
764 |
/// <param name="e"></param> |
765 |
private async void RadButton_Click_OLD(object sender, RoutedEventArgs e) |
766 |
{ |
767 |
var clickButtonItem = sender as RadButton; |
768 |
if (clickButtonItem != null && clickButtonItem.CommandParameter != null) |
769 |
{ |
770 |
try |
771 |
{ |
772 |
Rect rect = new Rect(); |
773 |
Point s_point = new Point(); |
774 |
Point e_point = new Point(); |
775 |
|
776 |
MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall; |
777 |
GotoPage(Convert.ToInt32(gaza.PageNumber)); |
778 |
|
779 |
var data = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(gaza.Data.ToString()); //언패킹작업 |
780 |
switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString())) |
781 |
{ |
782 |
case MarkupToPDF.Controls.Common.ControlType.TextControl: |
783 |
{ |
784 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
785 |
rect = new Rect(new Point(instance.StartPoint.X - 100, instance.StartPoint.Y - 100), new Point(instance.StartPoint.X + instance.BoxW + 100, instance.StartPoint.Y + instance.BoxW + 100)); |
786 |
} |
787 |
break; |
788 |
case MarkupToPDF.Controls.Common.ControlType.TextBorder: |
789 |
{ |
790 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
791 |
rect = new Rect(new Point(instance.StartPoint.X - 100, instance.StartPoint.Y - 100), new Point(instance.StartPoint.X + instance.BoxW + 100, instance.StartPoint.Y + instance.BoxW + 100)); |
792 |
} |
793 |
break; |
794 |
case MarkupToPDF.Controls.Common.ControlType.TextCloud: |
795 |
{ |
796 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
797 |
rect = new Rect(new Point(instance.StartPoint.X - 100, instance.StartPoint.Y - 100), new Point(instance.StartPoint.X + instance.BoxW + 100, instance.StartPoint.Y + instance.BoxW + 100)); |
798 |
} |
799 |
break; |
800 |
case MarkupToPDF.Controls.Common.ControlType.PolygonControl: |
801 |
{ |
802 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
803 |
|
804 |
foreach (Point A in instance.PointSet) |
805 |
{ |
806 |
if (s_point == new Point()) |
807 |
{ |
808 |
s_point = A; |
809 |
e_point = A; |
810 |
} |
811 |
s_point.X = Math.Min(s_point.X, A.X); |
812 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
813 |
e_point.X = Math.Max(e_point.X, A.X); |
814 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
815 |
} |
816 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
817 |
} |
818 |
break; |
819 |
case MarkupToPDF.Controls.Common.ControlType.PolygonCloud: |
820 |
{ |
821 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
822 |
|
823 |
foreach (Point A in instance.PointSet) |
824 |
{ |
825 |
if (s_point == new Point()) |
826 |
{ |
827 |
s_point = A; |
828 |
e_point = A; |
829 |
} |
830 |
s_point.X = Math.Min(s_point.X, A.X); |
831 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
832 |
e_point.X = Math.Max(e_point.X, A.X); |
833 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
834 |
} |
835 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
836 |
} |
837 |
break; |
838 |
case MarkupToPDF.Controls.Common.ControlType.ChainLine: |
839 |
{ |
840 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
841 |
|
842 |
foreach (Point A in instance.PointSet) |
843 |
{ |
844 |
if (s_point == new Point()) |
845 |
{ |
846 |
s_point = A; |
847 |
e_point = A; |
848 |
} |
849 |
s_point.X = Math.Min(s_point.X, A.X); |
850 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
851 |
e_point.X = Math.Max(e_point.X, A.X); |
852 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
853 |
} |
854 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
855 |
} |
856 |
break; |
857 |
case MarkupToPDF.Controls.Common.ControlType.Ink: |
858 |
{ |
859 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
860 |
|
861 |
foreach (Point A in instance.PointSet) |
862 |
{ |
863 |
if (s_point == new Point()) |
864 |
{ |
865 |
s_point = A; |
866 |
e_point = A; |
867 |
} |
868 |
s_point.X = Math.Min(s_point.X, A.X); |
869 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
870 |
e_point.X = Math.Max(e_point.X, A.X); |
871 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
872 |
} |
873 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
874 |
} |
875 |
break; |
876 |
default: |
877 |
MarkupToPDF.Serialize.S_Control.S_BaseControl item = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
878 |
rect = new Rect(new Point(item.StartPoint.X - 100, item.StartPoint.Y - 100), new Point(item.EndPoint.X + 100, item.EndPoint.Y + 100)); |
879 |
break; |
880 |
} |
881 |
|
882 |
SelectionSet.Instance.SelectItemByRect(rect, this.ParentOfType<KCOM.Views.MainMenu>()); |
883 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
884 |
} |
885 |
catch (Exception ex) |
886 |
{ |
887 |
this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error"); |
888 |
} |
889 |
} |
890 |
} |
891 |
|
892 |
|
893 |
private void btGotoMarkup_Click(object sender, RoutedEventArgs e) |
894 |
{ |
895 |
var clickButtonItem = sender as RadButton; |
896 |
if (clickButtonItem != null && clickButtonItem.CommandParameter != null) |
897 |
{ |
898 |
try |
899 |
{ |
900 |
|
901 |
|
902 |
MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall; |
903 |
MarkupList.SelectedItem = gaza; |
904 |
|
905 |
MarkupHelper.GotoMarkup(new[] { gaza.Id }); |
906 |
} |
907 |
catch (Exception ex) |
908 |
{ |
909 |
this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error"); |
910 |
} |
911 |
} |
912 |
} |
913 |
|
914 |
///// <summary> |
915 |
///// 선택된 마크업의 ID리스트를 받아 해당 페이지로 이동 후 GotoSelectedMarkup 호출 |
916 |
///// </summary> |
917 |
///// <param name="CommentIdList"></param> |
918 |
//private void GotoMarkup(IEnumerable<string> CommentIdList) |
919 |
//{ |
920 |
// var instance = Common.ViewerDataModel.Instance; |
921 |
|
922 |
// SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
923 |
|
924 |
// var commentList = instance._markupInfoList.Where(x => x.MarkupList != null).SelectMany(x => x.MarkupList).Where(f => f.ID == CommentIdList.First()); |
925 |
|
926 |
// if (commentList.Count() > 0) |
927 |
// { |
928 |
// //하단 그리드의 markup list에서 commentid가 포함된 markupinfo를 선택되게 한다. |
929 |
// #region markup list grid select items |
930 |
|
931 |
// var infoItem = instance._markupInfoList.Where(x => x.MarkupList != null).Where(f => f.MarkupList.Count(y => y == commentList.First()) > 0); |
932 |
|
933 |
// if (infoItem.Count() > 0) |
934 |
// { |
935 |
|
936 |
// var gridMarkup = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewMarkup; |
937 |
// gridMarkup.SelectedItems.Clear(); |
938 |
// gridMarkup.SelectedItems.Add(infoItem.First()); |
939 |
// } |
940 |
|
941 |
// #endregion |
942 |
|
943 |
// var pageNavigator = instance.SystemMain.dzMainMenu.pageNavigator; |
944 |
|
945 |
// if (pageNavigator.CurrentPage.PageNumber == commentList.First().PageNumber) |
946 |
// { |
947 |
// GotoSelectedMarkup(CommentIdList); |
948 |
// } |
949 |
// else |
950 |
// { |
951 |
// EventHandler<Sample.PageChangeEventArgs> handler = null; |
952 |
|
953 |
// handler = (snd, evt) => |
954 |
// { |
955 |
// GotoSelectedMarkup(CommentIdList); |
956 |
// pageNavigator.PageChanged -= handler; |
957 |
// }; |
958 |
|
959 |
// pageNavigator.PageChanged += handler; |
960 |
|
961 |
// pageNavigator.GotoPage(commentList.First().PageNumber); |
962 |
// } |
963 |
// } |
964 |
//} |
965 |
|
966 |
///// <summary> |
967 |
///// 페이지 이동 후 마크업을 선택하고 Zoom을 한다. |
968 |
///// 마크업이 페이지보다 크면 Zoom을 하지 않음. |
969 |
///// </summary> |
970 |
///// <param name="CommentIdList"></param> |
971 |
//private void GotoSelectedMarkup(IEnumerable<string> CommentIdList) |
972 |
//{ |
973 |
// var instance = Common.ViewerDataModel.Instance; |
974 |
|
975 |
// var selectOrderComments = instance.MarkupControls.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList(); |
976 |
// var commentUserInfo = instance.MarkupControls_USER.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList(); |
977 |
|
978 |
// if (commentUserInfo.Count() > 0 || selectOrderComments.Count() > 0) |
979 |
// { |
980 |
// commentUserInfo.ForEach(x => x.IsSelected = true); |
981 |
// commentUserInfo.AddRange(selectOrderComments); |
982 |
|
983 |
// if (commentUserInfo?.Count() > 0) |
984 |
// { |
985 |
// var main = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu; |
986 |
|
987 |
// try |
988 |
// { |
989 |
// if(Common.ViewerDataModel.Instance.Angle != 0) |
990 |
// { |
991 |
// for (int i = 0; i < (Common.ViewerDataModel.Instance.Angle / 90); i++) |
992 |
// { |
993 |
// Common.ViewerDataModel.Instance.SystemMain.dzTopMenu.drawingPannelRotate(true); |
994 |
// } |
995 |
|
996 |
// //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle = 0; |
997 |
// //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.X = 0; |
998 |
// //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.Y = 0; |
999 |
// } |
1000 |
|
1001 |
// Rect rect = commentUserInfo.First().ItemRect; |
1002 |
|
1003 |
// foreach (var UserInfo in commentUserInfo) |
1004 |
// { |
1005 |
// rect = Rect.Union(rect, UserInfo.ItemRect); |
1006 |
// } |
1007 |
|
1008 |
// SelectionSet.Instance.SelectItemByRect(rect, main); |
1009 |
|
1010 |
// var center = new Vector(Common.ViewerDataModel.Instance.ImageViewWidth / 2, Common.ViewerDataModel.Instance.ImageViewHeight / 2); |
1011 |
// //var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle); |
1012 |
// //rect.Transform(matrix); |
1013 |
|
1014 |
// double scaleX = Common.ViewerDataModel.Instance.ImageViewWidth / rect.Width; |
1015 |
// double scaleY = Common.ViewerDataModel.Instance.ImageViewHeight / rect.Height; |
1016 |
// double newScale = main.zoomAndPanControl.ContentScale * Math.Min(scaleX, scaleY); |
1017 |
// double positionX = 0; |
1018 |
// double positionY = 0; |
1019 |
|
1020 |
// if (Common.ViewerDataModel.Instance.Angle == 90) |
1021 |
// { |
1022 |
// positionX = Common.ViewerDataModel.Instance.ImageViewHeight + rect.X; |
1023 |
// positionY = Common.ViewerDataModel.Instance.ImageViewWidth + rect.Y; |
1024 |
// } |
1025 |
|
1026 |
// main.zoomAndPanControl.ContentScale = newScale; |
1027 |
// main.zoomAndPanControl.ContentOffsetX = positionX; |
1028 |
// main.zoomAndPanControl.ContentOffsetY = positionY; |
1029 |
|
1030 |
|
1031 |
// var pageSize = new Size(main.pageNavigator.CurrentPage.Width, main.pageNavigator.CurrentPage.Height); |
1032 |
|
1033 |
// double pageAngle = Common.ViewerDataModel.Instance.Angle; |
1034 |
|
1035 |
// if (pageAngle == 90) |
1036 |
// { |
1037 |
// pageAngle = 270; |
1038 |
// } |
1039 |
// else |
1040 |
// { |
1041 |
// pageAngle = 90; |
1042 |
// } |
1043 |
|
1044 |
// if ((rect.Size.Width + rect.Size.Height) > (pageSize.Width + pageSize.Height)) |
1045 |
// { |
1046 |
// var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle); |
1047 |
// rect.Transform(matrix); |
1048 |
|
1049 |
// main.zoomAndPanControl.ZoomTo(rect); |
1050 |
// } |
1051 |
// else |
1052 |
// { |
1053 |
// rect.Inflate(rect.Width * 3, rect.Height * 3); |
1054 |
|
1055 |
// var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle); |
1056 |
// rect.Transform(matrix); |
1057 |
|
1058 |
|
1059 |
// main.zoomAndPanControl.ZoomTo(rect); |
1060 |
// } |
1061 |
// } |
1062 |
// catch (Exception ex) |
1063 |
// { |
1064 |
// main.DialogMessage_Alert(ex.Message, "Error"); |
1065 |
// } |
1066 |
// } |
1067 |
// } |
1068 |
//} |
1069 |
|
1070 |
private void MarkupList_Loaded(object sender, RoutedEventArgs e) |
1071 |
{ |
1072 |
if (MarkupInfoSmallList.Count == 0) |
1073 |
{ |
1074 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
1075 |
{ |
1076 |
if (d.MarkupList != null) |
1077 |
{ |
1078 |
d.MarkupList.ForEach(b => |
1079 |
{ |
1080 |
bool isConsolidate = false; |
1081 |
|
1082 |
if(d.Consolidate == 1 && d.AvoidConsolidate == 0) |
1083 |
{ |
1084 |
isConsolidate = true; |
1085 |
} |
1086 |
|
1087 |
System.Diagnostics.Debug.WriteLine($"UserID : {d.UserID} Consolidate : {d.Consolidate} AvoidConsolidate : {d.AvoidConsolidate}"); |
1088 |
|
1089 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
1090 |
{ |
1091 |
Id = b.ID, |
1092 |
Data = b.Data, |
1093 |
Data_Type = b.Data_Type, |
1094 |
PageNumber = b.PageNumber, |
1095 |
UserID = d.UserID, |
1096 |
UserName = d.UserName, |
1097 |
IsConsolidate = isConsolidate |
1098 |
|
1099 |
}); |
1100 |
}); |
1101 |
} |
1102 |
}); |
1103 |
MarkupList.ItemsSource = null; |
1104 |
MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
1105 |
|
1106 |
FilterUpdate(); |
1107 |
} |
1108 |
} |
1109 |
|
1110 |
public void MarkupListUpdate(MarkupReturn res, Event_Type eventType, string CommentID, MarkupInfoItem item) |
1111 |
{ |
1112 |
if (MarkupInfoSmallList.Count == 0) |
1113 |
{ |
1114 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
1115 |
{ |
1116 |
if (d.MarkupList != null) |
1117 |
{ |
1118 |
d.MarkupList.ForEach(b => |
1119 |
{ |
1120 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
1121 |
{ |
1122 |
Id = b.ID, |
1123 |
Data = b.Data, |
1124 |
Data_Type = b.Data_Type, |
1125 |
PageNumber = b.PageNumber, |
1126 |
UserID = d.UserID, |
1127 |
UserName = d.UserName, |
1128 |
}); |
1129 |
}); |
1130 |
} |
1131 |
}); |
1132 |
MarkupList.ItemsSource = null; |
1133 |
MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
1134 |
} |
1135 |
|
1136 |
switch (eventType) |
1137 |
{ |
1138 |
case Event_Type.Create: |
1139 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
1140 |
{ |
1141 |
Id = res.CommentID, |
1142 |
Data = res.ConvertData, |
1143 |
Data_Type = res.DATA_TYPE, |
1144 |
PageNumber = CurrentPage.PageNumber, |
1145 |
UserID = App.ViewInfo.UserID, |
1146 |
UserName = App.UserName, |
1147 |
}); |
1148 |
break; |
1149 |
case Event_Type.Delete: |
1150 |
if(CommentID == null) //user information list delete btn |
1151 |
{ |
1152 |
foreach (var delItem in item.MarkupList) |
1153 |
{ |
1154 |
MarkupInfoSmallList.RemoveAll(p => p.Id == delItem.ID); |
1155 |
} |
1156 |
} |
1157 |
else //delete, cut, |
1158 |
{ |
1159 |
MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(CommentID)); |
1160 |
} |
1161 |
break; |
1162 |
case Event_Type.Thumb://이동 회전 |
1163 |
MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(res.CommentID)); |
1164 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
1165 |
{ |
1166 |
Id = res.CommentID, |
1167 |
Data = res.ConvertData, |
1168 |
Data_Type = res.DATA_TYPE, |
1169 |
PageNumber = CurrentPage.PageNumber, |
1170 |
UserID = App.ViewInfo.UserID, |
1171 |
UserName = App.UserName, |
1172 |
}); |
1173 |
break; |
1174 |
default: |
1175 |
break; |
1176 |
} |
1177 |
|
1178 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
1179 |
|
1180 |
bool IsConsolidation = false; |
1181 |
string UserId = null; |
1182 |
|
1183 |
if (commentUser.SelectedValue != null) |
1184 |
{ |
1185 |
if (((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).UserName != "Consolidated") |
1186 |
{ |
1187 |
UserId = ((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).UserName; |
1188 |
} |
1189 |
else |
1190 |
{ |
1191 |
IsConsolidation = true; |
1192 |
} |
1193 |
} |
1194 |
|
1195 |
var filterItems = TempMarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)) |
1196 |
.WhereIf(UserId != null, d => d.UserName == ((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).ToString()) |
1197 |
.WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)); |
1198 |
|
1199 |
MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
1200 |
|
1201 |
FilterUpdate(); |
1202 |
} |
1203 |
|
1204 |
private void FilterUpdate(string selectUser = null) |
1205 |
{ |
1206 |
//var items = MarkupList.ItemsSource as List<MarkupInfoItemSmall>; |
1207 |
|
1208 |
//commentType.ItemsSource = items.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
1209 |
//commentPage.ItemsSource = items.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList(); |
1210 |
|
1211 |
|
1212 |
var items = MarkupList.ItemsSource as List<MarkupInfoItemSmall>; |
1213 |
|
1214 |
var filterUsers = MarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)) |
1215 |
.WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)); |
1216 |
|
1217 |
var filterTypes = MarkupInfoSmallList.WhereIf(selectUser != null, d => d.UserName == selectUser) |
1218 |
.WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)); |
1219 |
|
1220 |
var filterPages = MarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)) |
1221 |
.WhereIf(selectUser != null, d => d.UserName == selectUser); |
1222 |
|
1223 |
commentUser.ItemsSource = filterUsers.Select(d => d.UserName).Distinct().OrderBy(d => d).ToList(); |
1224 |
commentType.ItemsSource = filterTypes.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
1225 |
commentPage.ItemsSource = filterPages.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList(); |
1226 |
} |
1227 |
|
1228 |
|
1229 |
|
1230 |
private void commentFilter_SelectionChanged(object sender, SelectionChangedEventArgs e) |
1231 |
{ |
1232 |
MarkupList.ItemsSource = null; |
1233 |
txtSearch.Text = string.Empty; |
1234 |
|
1235 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
1236 |
|
1237 |
bool IsConsolidation = false; |
1238 |
string userName = null; |
1239 |
|
1240 |
if (commentUser.SelectedValue != null) |
1241 |
{ |
1242 |
if(commentUser.SelectedValue?.ToString() != "Consolidated") |
1243 |
{ |
1244 |
userName = commentUser.SelectedValue.ToString(); |
1245 |
} |
1246 |
else |
1247 |
{ |
1248 |
IsConsolidation = true; |
1249 |
} |
1250 |
} |
1251 |
|
1252 |
var filterItems = TempMarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)) |
1253 |
.WhereIf(userName != null, d => d.UserName == userName) |
1254 |
.WhereIf(IsConsolidation,d=>d.IsConsolidate == IsConsolidation) |
1255 |
.WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)); |
1256 |
|
1257 |
MarkupList.ItemsSource = filterItems.OrderBy(d => d.PageNumber).ToList(); |
1258 |
|
1259 |
FilterUpdate(); |
1260 |
} |
1261 |
|
1262 |
private void btnPanorama_Click(object sender, RoutedEventArgs e) |
1263 |
{ |
1264 |
ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow(); |
1265 |
} |
1266 |
|
1267 |
private async void btnSearch_Click(object sender, RoutedEventArgs e) |
1268 |
{ |
1269 |
string search_str = txtSearch.Text; |
1270 |
|
1271 |
if(string.IsNullOrWhiteSpace(search_str)) |
1272 |
{ |
1273 |
return; |
1274 |
} |
1275 |
|
1276 |
var sel_type = commentType.SelectedItem; |
1277 |
var sel_user = commentUser.SelectedItem; |
1278 |
var sel_page = commentPage.SelectedItem; |
1279 |
List<MarkupInfoItemSmall> small_list = new List<MarkupInfoItemSmall>(); |
1280 |
List<MarkupInfoItemSmall> list = MarkupInfoSmallList; |
1281 |
if (sel_page != null) |
1282 |
{ |
1283 |
list = list.Where(d => d.PageNumber == Convert.ToInt32(sel_page)).ToList(); |
1284 |
} |
1285 |
if (sel_type != null) |
1286 |
{ |
1287 |
list = list.Where(d => d.Data_Type == Convert.ToInt32(sel_type)).ToList(); |
1288 |
} |
1289 |
if (sel_user != null) |
1290 |
{ |
1291 |
list = list.Where(d => d.UserID == (sel_user as MarkupInfoItem).UserID).ToList(); |
1292 |
} |
1293 |
foreach (var item in list) |
1294 |
{ |
1295 |
var data = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(item.Data.ToString()); |
1296 |
|
1297 |
switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), item.Data_Type.ToString())) |
1298 |
{ |
1299 |
case MarkupToPDF.Controls.Common.ControlType.TextControl: |
1300 |
case MarkupToPDF.Controls.Common.ControlType.TextBorder: |
1301 |
case MarkupToPDF.Controls.Common.ControlType.TextCloud: |
1302 |
{ |
1303 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
1304 |
|
1305 |
if (!string.IsNullOrWhiteSpace(instance.Text)) |
1306 |
{ |
1307 |
if (instance.Text.ToLower().Contains(search_str.ToLower())) |
1308 |
{ |
1309 |
small_list.Add(item); |
1310 |
} |
1311 |
} |
1312 |
} |
1313 |
break; |
1314 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl: |
1315 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl: |
1316 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextControl: |
1317 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl: |
1318 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl: |
1319 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl: |
1320 |
{ |
1321 |
MarkupToPDF.Serialize.S_Control.S_ArrowTextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_ArrowTextControl>(data); |
1322 |
|
1323 |
if (!string.IsNullOrWhiteSpace(instance.ArrowText)) |
1324 |
{ |
1325 |
if (instance.ArrowText.Contains(search_str)) |
1326 |
{ |
1327 |
small_list.Add(item); |
1328 |
} |
1329 |
} |
1330 |
} |
1331 |
break; |
1332 |
} |
1333 |
} |
1334 |
|
1335 |
MarkupList.ItemsSource = null; |
1336 |
MarkupList.ItemsSource = small_list.OrderBy(d => d.PageNumber).ToList(); |
1337 |
} |
1338 |
|
1339 |
private void TxtSearch_KeyDown(object sender, KeyEventArgs e) |
1340 |
{ |
1341 |
if(e.Key == Key.Enter || e.Key == Key.Return) |
1342 |
{ |
1343 |
btnSearch_Click(sender, new RoutedEventArgs()); |
1344 |
} |
1345 |
} |
1346 |
|
1347 |
} |
1348 |
} |