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