markus / KCOM / Controls / Sample.xaml.cs @ 448c5399
이력 | 보기 | 이력해설 | 다운로드 (58.6 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 |
System.Diagnostics.Debug.WriteLine("thumbnail download process " + page.PAGE_NUMBER); |
592 |
|
593 |
//} |
594 |
//ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page => |
595 |
//{ |
596 |
var _pageNo = page.PAGE_NUMBER; |
597 |
bool _addFlag = false; |
598 |
|
599 |
if (rdoFavoritePages.IsChecked == false) |
600 |
{ |
601 |
if (_selectComment.Count() > 0) |
602 |
{ |
603 |
if ((rdoAllPages.IsChecked == true) |
604 |
|| (expCommentPages.IsExpanded == true && _selectComment.Where(s => s == _pageNo).Count() > 0)) |
605 |
{ |
606 |
_addFlag = true; |
607 |
} |
608 |
} |
609 |
else |
610 |
{ |
611 |
//if (App.ViewInfo.IsCustomPage) |
612 |
//{ |
613 |
// //_addFlag = false; |
614 |
|
615 |
// //App.ViewInfo.IsCustomPage = false; |
616 |
// //this.rdoAllPages.Visibility = System.Windows.Visibility.Collapsed; |
617 |
// //this.lstSelectComment.Visibility = System.Windows.Visibility.Collapsed; |
618 |
// this.rdoAllPages.IsChecked = false; |
619 |
// this.rdoFavoritePages.IsChecked = true; |
620 |
// //SetCommentPages(); |
621 |
//} |
622 |
//else |
623 |
//{ |
624 |
_addFlag = true; |
625 |
//} |
626 |
} |
627 |
} |
628 |
|
629 |
var pageUri = await samplePageStorage.GetPageUriAsync(_pageNo); |
630 |
|
631 |
if (_addFlag) |
632 |
{ |
633 |
|
634 |
this._thumbnailItems.Add(new ThumbnailItem |
635 |
{ |
636 |
ImageUri = pageUri, |
637 |
PageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString()).Replace("jpg","png")), |
638 |
PageNumber = _pageNo, |
639 |
Angle = page.PAGE_ANGLE, |
640 |
}); |
641 |
} |
642 |
else |
643 |
{ |
644 |
if ((rdoFavoritePages.IsChecked == true) && _FavoriteSet.Where(data => data.PAGE_NO == _pageNo).FirstOrDefault() != null) |
645 |
{ |
646 |
this._thumbnailItems.Add(new ThumbnailItem |
647 |
{ |
648 |
ImageUri = pageUri, |
649 |
PageNumber = _pageNo, |
650 |
Angle = page.PAGE_ANGLE, |
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 |
if (ThumbInitialized != null) |
682 |
{ |
683 |
ThumbInitialized(this, new EventArgs()); |
684 |
} |
685 |
} |
686 |
else |
687 |
{ |
688 |
ImgListbox.UpdateLayout(); |
689 |
ImgListbox.ItemsSource = this._thumbnailItems; |
690 |
} |
691 |
|
692 |
} |
693 |
|
694 |
//if (ImgListbox.ItemsSource == null) |
695 |
//{ |
696 |
// ImgListbox.ItemsSource = this._thumbnailItems; |
697 |
|
698 |
// //this.CurrentPage = this._thumbnailItems.FirstOrDefault(); |
699 |
|
700 |
// //this._thumbnailItems.ToList().ForEach(data => |
701 |
// //{ |
702 |
// // data.Width = ImgListbox.ActualWidth; |
703 |
// // data.Height = ImgListbox.ActualHeight; |
704 |
// //}); |
705 |
|
706 |
// if (ImgListbox.Items.Count > 0) |
707 |
// { |
708 |
// int StartPageIdx = 1; |
709 |
|
710 |
// if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1) |
711 |
// { |
712 |
// ImgListbox.SelectedItem = ImgListbox.Items[0]; |
713 |
// } |
714 |
// else |
715 |
// { |
716 |
// ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx]; |
717 |
// } |
718 |
// } |
719 |
//} |
720 |
//else |
721 |
//{ |
722 |
// ImgListbox.UpdateLayout(); |
723 |
// ImgListbox.ItemsSource = this._thumbnailItems; |
724 |
//} |
725 |
|
726 |
//if(ThumbInitialized != null) |
727 |
//{ |
728 |
// ThumbInitialized(this, new EventArgs()); |
729 |
//} |
730 |
} |
731 |
|
732 |
private async void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
733 |
{ |
734 |
if (e.ClickCount >= 2) |
735 |
{ |
736 |
var selectItem = MarkupList.SelectedItem as IKCOM.MarkupItem; |
737 |
|
738 |
GotoPage(selectItem.PageNumber); |
739 |
|
740 |
var result = await MarkupParser.GetBaseControlAsync(selectItem.Data); |
741 |
|
742 |
Rect rect = new Rect(new Point(result.StartPoint.X - 100, result.StartPoint.Y - 100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100)); |
743 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
744 |
//bool isGO = false; |
745 |
|
746 |
//var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer; |
747 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit; |
748 |
//imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle; |
749 |
//imageViewer.InteractiveUserRectangle += (sen, ea) => |
750 |
//{ |
751 |
// System.Diagnostics.Debug.WriteLine(ea.Bounds); |
752 |
// if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End) |
753 |
// { |
754 |
// this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds); |
755 |
// } |
756 |
|
757 |
//}; |
758 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal; |
759 |
|
760 |
//GotoPage(MarkupList.SelectedItem as MarkupList) |
761 |
} |
762 |
} |
763 |
|
764 |
public class MarkupInfoItemSmall |
765 |
{ |
766 |
public string Id { get; set; } |
767 |
public string UserName { get; set; } |
768 |
public string UserID { get; set; } |
769 |
public int PageNumber { get; set; } |
770 |
public string Data { get; set; } |
771 |
public int Data_Type { get; set; } |
772 |
public bool IsConsolidate { get; set; } |
773 |
} |
774 |
|
775 |
private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; } |
776 |
public List<MarkupInfoItemSmall> MarkupInfoSmallList |
777 |
{ |
778 |
get |
779 |
{ |
780 |
if (_MarkupInfoSmallList == null) |
781 |
{ |
782 |
_MarkupInfoSmallList = new List<MarkupInfoItemSmall>(); |
783 |
} |
784 |
return _MarkupInfoSmallList; |
785 |
} |
786 |
set |
787 |
{ |
788 |
|
789 |
_MarkupInfoSmallList = value; |
790 |
RaisePropertyChanged("MarkupInfoSmallList"); |
791 |
} |
792 |
} |
793 |
|
794 |
/// <summary> |
795 |
/// goto page and select item selected by user |
796 |
/// </summary> |
797 |
/// <param name="sender"></param> |
798 |
/// <param name="e"></param> |
799 |
private async void RadButton_Click_OLD(object sender, RoutedEventArgs e) |
800 |
{ |
801 |
var clickButtonItem = sender as RadButton; |
802 |
if (clickButtonItem != null && clickButtonItem.CommandParameter != null) |
803 |
{ |
804 |
try |
805 |
{ |
806 |
Rect rect = new Rect(); |
807 |
Point s_point = new Point(); |
808 |
Point e_point = new Point(); |
809 |
|
810 |
MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall; |
811 |
GotoPage(Convert.ToInt32(gaza.PageNumber)); |
812 |
|
813 |
var data = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(gaza.Data.ToString()); //언패킹작업 |
814 |
switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString())) |
815 |
{ |
816 |
case MarkupToPDF.Controls.Common.ControlType.TextControl: |
817 |
{ |
818 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
819 |
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)); |
820 |
} |
821 |
break; |
822 |
case MarkupToPDF.Controls.Common.ControlType.TextBorder: |
823 |
{ |
824 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
825 |
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)); |
826 |
} |
827 |
break; |
828 |
case MarkupToPDF.Controls.Common.ControlType.TextCloud: |
829 |
{ |
830 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
831 |
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)); |
832 |
} |
833 |
break; |
834 |
case MarkupToPDF.Controls.Common.ControlType.PolygonControl: |
835 |
{ |
836 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
837 |
|
838 |
foreach (Point A in instance.PointSet) |
839 |
{ |
840 |
if (s_point == new Point()) |
841 |
{ |
842 |
s_point = A; |
843 |
e_point = A; |
844 |
} |
845 |
s_point.X = Math.Min(s_point.X, A.X); |
846 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
847 |
e_point.X = Math.Max(e_point.X, A.X); |
848 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
849 |
} |
850 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
851 |
} |
852 |
break; |
853 |
case MarkupToPDF.Controls.Common.ControlType.PolygonCloud: |
854 |
{ |
855 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
856 |
|
857 |
foreach (Point A in instance.PointSet) |
858 |
{ |
859 |
if (s_point == new Point()) |
860 |
{ |
861 |
s_point = A; |
862 |
e_point = A; |
863 |
} |
864 |
s_point.X = Math.Min(s_point.X, A.X); |
865 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
866 |
e_point.X = Math.Max(e_point.X, A.X); |
867 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
868 |
} |
869 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
870 |
} |
871 |
break; |
872 |
case MarkupToPDF.Controls.Common.ControlType.ChainLine: |
873 |
{ |
874 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
875 |
|
876 |
foreach (Point A in instance.PointSet) |
877 |
{ |
878 |
if (s_point == new Point()) |
879 |
{ |
880 |
s_point = A; |
881 |
e_point = A; |
882 |
} |
883 |
s_point.X = Math.Min(s_point.X, A.X); |
884 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
885 |
e_point.X = Math.Max(e_point.X, A.X); |
886 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
887 |
} |
888 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
889 |
} |
890 |
break; |
891 |
case MarkupToPDF.Controls.Common.ControlType.Ink: |
892 |
{ |
893 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
894 |
|
895 |
foreach (Point A in instance.PointSet) |
896 |
{ |
897 |
if (s_point == new Point()) |
898 |
{ |
899 |
s_point = A; |
900 |
e_point = A; |
901 |
} |
902 |
s_point.X = Math.Min(s_point.X, A.X); |
903 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
904 |
e_point.X = Math.Max(e_point.X, A.X); |
905 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
906 |
} |
907 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
908 |
} |
909 |
break; |
910 |
default: |
911 |
MarkupToPDF.Serialize.S_Control.S_BaseControl item = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
912 |
rect = new Rect(new Point(item.StartPoint.X - 100, item.StartPoint.Y - 100), new Point(item.EndPoint.X + 100, item.EndPoint.Y + 100)); |
913 |
break; |
914 |
} |
915 |
|
916 |
SelectionSet.Instance.SelectItemByRect(rect, this.ParentOfType<KCOM.Views.MainMenu>()); |
917 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
918 |
} |
919 |
catch (Exception ex) |
920 |
{ |
921 |
this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error"); |
922 |
} |
923 |
} |
924 |
} |
925 |
|
926 |
|
927 |
private void btGotoMarkup_Click(object sender, RoutedEventArgs e) |
928 |
{ |
929 |
var clickButtonItem = sender as RadButton; |
930 |
if (clickButtonItem != null && clickButtonItem.CommandParameter != null) |
931 |
{ |
932 |
try |
933 |
{ |
934 |
|
935 |
|
936 |
MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall; |
937 |
MarkupList.SelectedItem = gaza; |
938 |
|
939 |
MarkupHelper.GotoMarkup(new[] { gaza.Id }); |
940 |
} |
941 |
catch (Exception ex) |
942 |
{ |
943 |
this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error"); |
944 |
} |
945 |
} |
946 |
} |
947 |
|
948 |
///// <summary> |
949 |
///// 선택된 마크업의 ID리스트를 받아 해당 페이지로 이동 후 GotoSelectedMarkup 호출 |
950 |
///// </summary> |
951 |
///// <param name="CommentIdList"></param> |
952 |
//private void GotoMarkup(IEnumerable<string> CommentIdList) |
953 |
//{ |
954 |
// var instance = Common.ViewerDataModel.Instance; |
955 |
|
956 |
// SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
957 |
|
958 |
// var commentList = instance._markupInfoList.Where(x => x.MarkupList != null).SelectMany(x => x.MarkupList).Where(f => f.ID == CommentIdList.First()); |
959 |
|
960 |
// if (commentList.Count() > 0) |
961 |
// { |
962 |
// //하단 그리드의 markup list에서 commentid가 포함된 markupinfo를 선택되게 한다. |
963 |
// #region markup list grid select items |
964 |
|
965 |
// var infoItem = instance._markupInfoList.Where(x => x.MarkupList != null).Where(f => f.MarkupList.Count(y => y == commentList.First()) > 0); |
966 |
|
967 |
// if (infoItem.Count() > 0) |
968 |
// { |
969 |
|
970 |
// var gridMarkup = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewMarkup; |
971 |
// gridMarkup.SelectedItems.Clear(); |
972 |
// gridMarkup.SelectedItems.Add(infoItem.First()); |
973 |
// } |
974 |
|
975 |
// #endregion |
976 |
|
977 |
// var pageNavigator = instance.SystemMain.dzMainMenu.pageNavigator; |
978 |
|
979 |
// if (pageNavigator.CurrentPage.PageNumber == commentList.First().PageNumber) |
980 |
// { |
981 |
// GotoSelectedMarkup(CommentIdList); |
982 |
// } |
983 |
// else |
984 |
// { |
985 |
// EventHandler<Sample.PageChangeEventArgs> handler = null; |
986 |
|
987 |
// handler = (snd, evt) => |
988 |
// { |
989 |
// GotoSelectedMarkup(CommentIdList); |
990 |
// pageNavigator.PageChanged -= handler; |
991 |
// }; |
992 |
|
993 |
// pageNavigator.PageChanged += handler; |
994 |
|
995 |
// pageNavigator.GotoPage(commentList.First().PageNumber); |
996 |
// } |
997 |
// } |
998 |
//} |
999 |
|
1000 |
///// <summary> |
1001 |
///// 페이지 이동 후 마크업을 선택하고 Zoom을 한다. |
1002 |
///// 마크업이 페이지보다 크면 Zoom을 하지 않음. |
1003 |
///// </summary> |
1004 |
///// <param name="CommentIdList"></param> |
1005 |
//private void GotoSelectedMarkup(IEnumerable<string> CommentIdList) |
1006 |
//{ |
1007 |
// var instance = Common.ViewerDataModel.Instance; |
1008 |
|
1009 |
// var selectOrderComments = instance.MarkupControls.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList(); |
1010 |
// var commentUserInfo = instance.MarkupControls_USER.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList(); |
1011 |
|
1012 |
// if (commentUserInfo.Count() > 0 || selectOrderComments.Count() > 0) |
1013 |
// { |
1014 |
// commentUserInfo.ForEach(x => x.IsSelected = true); |
1015 |
// commentUserInfo.AddRange(selectOrderComments); |
1016 |
|
1017 |
// if (commentUserInfo?.Count() > 0) |
1018 |
// { |
1019 |
// var main = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu; |
1020 |
|
1021 |
// try |
1022 |
// { |
1023 |
// if(Common.ViewerDataModel.Instance.Angle != 0) |
1024 |
// { |
1025 |
// for (int i = 0; i < (Common.ViewerDataModel.Instance.Angle / 90); i++) |
1026 |
// { |
1027 |
// Common.ViewerDataModel.Instance.SystemMain.dzTopMenu.drawingPannelRotate(true); |
1028 |
// } |
1029 |
|
1030 |
// //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle = 0; |
1031 |
// //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.X = 0; |
1032 |
// //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.Y = 0; |
1033 |
// } |
1034 |
|
1035 |
// Rect rect = commentUserInfo.First().ItemRect; |
1036 |
|
1037 |
// foreach (var UserInfo in commentUserInfo) |
1038 |
// { |
1039 |
// rect = Rect.Union(rect, UserInfo.ItemRect); |
1040 |
// } |
1041 |
|
1042 |
// SelectionSet.Instance.SelectItemByRect(rect, main); |
1043 |
|
1044 |
// var center = new Vector(Common.ViewerDataModel.Instance.ImageViewWidth / 2, Common.ViewerDataModel.Instance.ImageViewHeight / 2); |
1045 |
// //var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle); |
1046 |
// //rect.Transform(matrix); |
1047 |
|
1048 |
// double scaleX = Common.ViewerDataModel.Instance.ImageViewWidth / rect.Width; |
1049 |
// double scaleY = Common.ViewerDataModel.Instance.ImageViewHeight / rect.Height; |
1050 |
// double newScale = main.zoomAndPanControl.ContentScale * Math.Min(scaleX, scaleY); |
1051 |
// double positionX = 0; |
1052 |
// double positionY = 0; |
1053 |
|
1054 |
// if (Common.ViewerDataModel.Instance.Angle == 90) |
1055 |
// { |
1056 |
// positionX = Common.ViewerDataModel.Instance.ImageViewHeight + rect.X; |
1057 |
// positionY = Common.ViewerDataModel.Instance.ImageViewWidth + rect.Y; |
1058 |
// } |
1059 |
|
1060 |
// main.zoomAndPanControl.ContentScale = newScale; |
1061 |
// main.zoomAndPanControl.ContentOffsetX = positionX; |
1062 |
// main.zoomAndPanControl.ContentOffsetY = positionY; |
1063 |
|
1064 |
|
1065 |
// var pageSize = new Size(main.pageNavigator.CurrentPage.Width, main.pageNavigator.CurrentPage.Height); |
1066 |
|
1067 |
// double pageAngle = Common.ViewerDataModel.Instance.Angle; |
1068 |
|
1069 |
// if (pageAngle == 90) |
1070 |
// { |
1071 |
// pageAngle = 270; |
1072 |
// } |
1073 |
// else |
1074 |
// { |
1075 |
// pageAngle = 90; |
1076 |
// } |
1077 |
|
1078 |
// if ((rect.Size.Width + rect.Size.Height) > (pageSize.Width + pageSize.Height)) |
1079 |
// { |
1080 |
// var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle); |
1081 |
// rect.Transform(matrix); |
1082 |
|
1083 |
// main.zoomAndPanControl.ZoomTo(rect); |
1084 |
// } |
1085 |
// else |
1086 |
// { |
1087 |
// rect.Inflate(rect.Width * 3, rect.Height * 3); |
1088 |
|
1089 |
// var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle); |
1090 |
// rect.Transform(matrix); |
1091 |
|
1092 |
|
1093 |
// main.zoomAndPanControl.ZoomTo(rect); |
1094 |
// } |
1095 |
// } |
1096 |
// catch (Exception ex) |
1097 |
// { |
1098 |
// main.DialogMessage_Alert(ex.Message, "Error"); |
1099 |
// } |
1100 |
// } |
1101 |
// } |
1102 |
//} |
1103 |
|
1104 |
private void MarkupList_Loaded(object sender, RoutedEventArgs e) |
1105 |
{ |
1106 |
if (MarkupInfoSmallList.Count == 0) |
1107 |
{ |
1108 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
1109 |
{ |
1110 |
if (d.MarkupList != null) |
1111 |
{ |
1112 |
d.MarkupList.ForEach(b => |
1113 |
{ |
1114 |
bool isConsolidate = false; |
1115 |
|
1116 |
if(d.Consolidate == 1 && d.AvoidConsolidate == 0) |
1117 |
{ |
1118 |
isConsolidate = true; |
1119 |
} |
1120 |
|
1121 |
System.Diagnostics.Debug.WriteLine($"UserID : {d.UserID} Consolidate : {d.Consolidate} AvoidConsolidate : {d.AvoidConsolidate}"); |
1122 |
|
1123 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
1124 |
{ |
1125 |
Id = b.ID, |
1126 |
Data = b.Data, |
1127 |
Data_Type = b.Data_Type, |
1128 |
PageNumber = b.PageNumber, |
1129 |
UserID = d.UserID, |
1130 |
UserName = d.UserName, |
1131 |
IsConsolidate = isConsolidate |
1132 |
|
1133 |
}); |
1134 |
}); |
1135 |
} |
1136 |
}); |
1137 |
MarkupList.ItemsSource = null; |
1138 |
MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
1139 |
|
1140 |
FilterUpdate(); |
1141 |
} |
1142 |
} |
1143 |
|
1144 |
public void MarkupListUpdate(MarkupReturn res, Event_Type eventType, string CommentID, MarkupInfoItem item) |
1145 |
{ |
1146 |
if (MarkupInfoSmallList.Count == 0) |
1147 |
{ |
1148 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
1149 |
{ |
1150 |
if (d.MarkupList != null) |
1151 |
{ |
1152 |
d.MarkupList.ForEach(b => |
1153 |
{ |
1154 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
1155 |
{ |
1156 |
Id = b.ID, |
1157 |
Data = b.Data, |
1158 |
Data_Type = b.Data_Type, |
1159 |
PageNumber = b.PageNumber, |
1160 |
UserID = d.UserID, |
1161 |
UserName = d.UserName, |
1162 |
}); |
1163 |
}); |
1164 |
} |
1165 |
}); |
1166 |
MarkupList.ItemsSource = null; |
1167 |
MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
1168 |
} |
1169 |
|
1170 |
switch (eventType) |
1171 |
{ |
1172 |
case Event_Type.Create: |
1173 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
1174 |
{ |
1175 |
Id = res.CommentID, |
1176 |
Data = res.ConvertData, |
1177 |
Data_Type = res.DATA_TYPE, |
1178 |
PageNumber = CurrentPage.PageNumber, |
1179 |
UserID = App.ViewInfo.UserID, |
1180 |
UserName = App.UserName, |
1181 |
}); |
1182 |
break; |
1183 |
case Event_Type.Delete: |
1184 |
if(CommentID == null) //user information list delete btn |
1185 |
{ |
1186 |
foreach (var delItem in item.MarkupList) |
1187 |
{ |
1188 |
MarkupInfoSmallList.RemoveAll(p => p.Id == delItem.ID); |
1189 |
} |
1190 |
} |
1191 |
else //delete, cut, |
1192 |
{ |
1193 |
MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(CommentID)); |
1194 |
} |
1195 |
break; |
1196 |
case Event_Type.Thumb://이동 회전 |
1197 |
MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(res.CommentID)); |
1198 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
1199 |
{ |
1200 |
Id = res.CommentID, |
1201 |
Data = res.ConvertData, |
1202 |
Data_Type = res.DATA_TYPE, |
1203 |
PageNumber = CurrentPage.PageNumber, |
1204 |
UserID = App.ViewInfo.UserID, |
1205 |
UserName = App.UserName, |
1206 |
}); |
1207 |
break; |
1208 |
default: |
1209 |
break; |
1210 |
} |
1211 |
|
1212 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
1213 |
|
1214 |
bool IsConsolidation = false; |
1215 |
string UserId = null; |
1216 |
|
1217 |
if (commentUser.SelectedValue != null) |
1218 |
{ |
1219 |
if (((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).UserName != "Consolidated") |
1220 |
{ |
1221 |
UserId = ((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).UserName; |
1222 |
} |
1223 |
else |
1224 |
{ |
1225 |
IsConsolidation = true; |
1226 |
} |
1227 |
} |
1228 |
|
1229 |
var filterItems = TempMarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)) |
1230 |
.WhereIf(UserId != null, d => d.UserName == ((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).ToString()) |
1231 |
.WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)); |
1232 |
|
1233 |
MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
1234 |
|
1235 |
FilterUpdate(); |
1236 |
} |
1237 |
|
1238 |
private void FilterUpdate(string selectUser = null) |
1239 |
{ |
1240 |
//var items = MarkupList.ItemsSource as List<MarkupInfoItemSmall>; |
1241 |
|
1242 |
//commentType.ItemsSource = items.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
1243 |
//commentPage.ItemsSource = items.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList(); |
1244 |
|
1245 |
|
1246 |
var items = MarkupList.ItemsSource as List<MarkupInfoItemSmall>; |
1247 |
|
1248 |
var filterUsers = MarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)) |
1249 |
.WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)); |
1250 |
|
1251 |
var filterTypes = MarkupInfoSmallList.WhereIf(selectUser != null, d => d.UserName == selectUser) |
1252 |
.WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)); |
1253 |
|
1254 |
var filterPages = MarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)) |
1255 |
.WhereIf(selectUser != null, d => d.UserName == selectUser); |
1256 |
|
1257 |
commentUser.ItemsSource = filterUsers.Select(d => d.UserName).Distinct().OrderBy(d => d).ToList(); |
1258 |
commentType.ItemsSource = filterTypes.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
1259 |
commentPage.ItemsSource = filterPages.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList(); |
1260 |
} |
1261 |
|
1262 |
|
1263 |
|
1264 |
private void commentFilter_SelectionChanged(object sender, SelectionChangedEventArgs e) |
1265 |
{ |
1266 |
MarkupList.ItemsSource = null; |
1267 |
txtSearch.Text = string.Empty; |
1268 |
|
1269 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
1270 |
|
1271 |
bool IsConsolidation = false; |
1272 |
string userName = null; |
1273 |
|
1274 |
if (commentUser.SelectedValue != null) |
1275 |
{ |
1276 |
if(commentUser.SelectedValue?.ToString() != "Consolidated") |
1277 |
{ |
1278 |
userName = commentUser.SelectedValue.ToString(); |
1279 |
} |
1280 |
else |
1281 |
{ |
1282 |
IsConsolidation = true; |
1283 |
} |
1284 |
} |
1285 |
|
1286 |
var filterItems = TempMarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)) |
1287 |
.WhereIf(userName != null, d => d.UserName == userName) |
1288 |
.WhereIf(IsConsolidation,d=>d.IsConsolidate == IsConsolidation) |
1289 |
.WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)); |
1290 |
|
1291 |
MarkupList.ItemsSource = filterItems.OrderBy(d => d.PageNumber).ToList(); |
1292 |
|
1293 |
FilterUpdate(); |
1294 |
} |
1295 |
|
1296 |
private void btnPanorama_Click(object sender, RoutedEventArgs e) |
1297 |
{ |
1298 |
ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow(); |
1299 |
} |
1300 |
|
1301 |
private async void btnSearch_Click(object sender, RoutedEventArgs e) |
1302 |
{ |
1303 |
string search_str = txtSearch.Text; |
1304 |
|
1305 |
if(string.IsNullOrWhiteSpace(search_str)) |
1306 |
{ |
1307 |
return; |
1308 |
} |
1309 |
|
1310 |
var sel_type = commentType.SelectedItem; |
1311 |
var sel_user = commentUser.SelectedItem; |
1312 |
var sel_page = commentPage.SelectedItem; |
1313 |
List<MarkupInfoItemSmall> small_list = new List<MarkupInfoItemSmall>(); |
1314 |
List<MarkupInfoItemSmall> list = MarkupInfoSmallList; |
1315 |
if (sel_page != null) |
1316 |
{ |
1317 |
list = list.Where(d => d.PageNumber == Convert.ToInt32(sel_page)).ToList(); |
1318 |
} |
1319 |
if (sel_type != null) |
1320 |
{ |
1321 |
list = list.Where(d => d.Data_Type == Convert.ToInt32(sel_type)).ToList(); |
1322 |
} |
1323 |
if (sel_user != null) |
1324 |
{ |
1325 |
list = list.Where(d => d.UserID == (sel_user as MarkupInfoItem).UserID).ToList(); |
1326 |
} |
1327 |
foreach (var item in list) |
1328 |
{ |
1329 |
var data = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(item.Data.ToString()); |
1330 |
|
1331 |
switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), item.Data_Type.ToString())) |
1332 |
{ |
1333 |
case MarkupToPDF.Controls.Common.ControlType.TextControl: |
1334 |
case MarkupToPDF.Controls.Common.ControlType.TextBorder: |
1335 |
case MarkupToPDF.Controls.Common.ControlType.TextCloud: |
1336 |
{ |
1337 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
1338 |
|
1339 |
if (!string.IsNullOrWhiteSpace(instance.Text)) |
1340 |
{ |
1341 |
if (instance.Text.ToLower().Contains(search_str.ToLower())) |
1342 |
{ |
1343 |
small_list.Add(item); |
1344 |
} |
1345 |
} |
1346 |
} |
1347 |
break; |
1348 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl: |
1349 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl: |
1350 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextControl: |
1351 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl: |
1352 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl: |
1353 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl: |
1354 |
{ |
1355 |
MarkupToPDF.Serialize.S_Control.S_ArrowTextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_ArrowTextControl>(data); |
1356 |
|
1357 |
if (!string.IsNullOrWhiteSpace(instance.ArrowText)) |
1358 |
{ |
1359 |
if (instance.ArrowText.Contains(search_str)) |
1360 |
{ |
1361 |
small_list.Add(item); |
1362 |
} |
1363 |
} |
1364 |
} |
1365 |
break; |
1366 |
} |
1367 |
} |
1368 |
|
1369 |
MarkupList.ItemsSource = null; |
1370 |
MarkupList.ItemsSource = small_list.OrderBy(d => d.PageNumber).ToList(); |
1371 |
} |
1372 |
|
1373 |
private void TxtSearch_KeyDown(object sender, KeyEventArgs e) |
1374 |
{ |
1375 |
if(e.Key == Key.Enter || e.Key == Key.Return) |
1376 |
{ |
1377 |
btnSearch_Click(sender, new RoutedEventArgs()); |
1378 |
} |
1379 |
} |
1380 |
} |
1381 |
} |