markus / KCOM / Controls / Sample.xaml.cs @ 81e3a60f
이력 | 보기 | 이력해설 | 다운로드 (47.2 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.Windows; |
13 |
using System.Windows.Controls; |
14 |
using System.Windows.Input; |
15 |
using System.Windows.Media; |
16 |
using Telerik.Windows.Controls; |
17 |
using static MarkupToPDF.Controls.Parsing.MarkupParser; |
18 |
|
19 |
namespace KCOM.Controls |
20 |
{ |
21 |
/// <summary> |
22 |
/// Interaction logic for PageNavigator.xaml |
23 |
/// </summary> |
24 |
public partial class Sample : UserControl, INotifyPropertyChanged |
25 |
{ |
26 |
public List<FAVORITE_DOC> _FavoriteSet { get; set; } |
27 |
public event PropertyChangedEventHandler PropertyChanged; |
28 |
public Sample() |
29 |
{ |
30 |
App.splashString(ISplashMessage.SAMPLE); |
31 |
this.Loaded += Sample_Loaded; |
32 |
} |
33 |
|
34 |
private void Sample_Loaded(object sender, RoutedEventArgs e) |
35 |
{ |
36 |
if(!_Initialize) |
37 |
{ |
38 |
InitializeComponent(); |
39 |
_Initialize = true; |
40 |
this.lstSelectComment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(lstSelectComment_SelectionChanged); |
41 |
this.ImgListbox.SelectionChanged += new SelectionChangedEventHandler(ImgListbox_SelectionChanged); |
42 |
} |
43 |
} |
44 |
|
45 |
public ObservableCollection<ThumbnailItem> _thumbnailItems; |
46 |
private List<DOCPAGE> _PageList = null; |
47 |
private string _DefaultUri = null; |
48 |
public ThumbnailItem CurrentPage = null; |
49 |
public int PageCount = 0; |
50 |
private bool _Initialize; |
51 |
public event EventHandler<PageChangeEventArgs> PageChanged; |
52 |
public event EventHandler<PageChangeEventArgs> PageChanging; |
53 |
List<UsersCommentPagesMember> _UsersCommentPagesList = new List<UsersCommentPagesMember>(); |
54 |
public class PageChangeEventArgs : EventArgs |
55 |
{ |
56 |
public DOCPAGE CurrentPage { get; set; } |
57 |
public string PageUri { get; set; } |
58 |
public int PageNumber { get; set; } |
59 |
} |
60 |
private bool _IsFitOn { get; set; } |
61 |
public bool IsFitOn |
62 |
{ |
63 |
get |
64 |
{ |
65 |
return _IsFitOn; |
66 |
} |
67 |
set |
68 |
{ |
69 |
_IsFitOn = value; |
70 |
RaisePropertyChanged("IsFitOn"); |
71 |
} |
72 |
} |
73 |
|
74 |
public void RaisePropertyChanged(string propName) |
75 |
{ |
76 |
if (PropertyChanged != null) |
77 |
PropertyChanged(this, new PropertyChangedEventArgs(propName)); |
78 |
} |
79 |
|
80 |
public void SetPageNavi(List<DOCPAGE> PageList, string DefaultUri) |
81 |
{ |
82 |
Logger.sendCheckLog("SetPageNavi", 1); |
83 |
this._PageList = PageList; |
84 |
this._DefaultUri = DefaultUri; |
85 |
ThumbnailSet(); |
86 |
this.PageCount = PageList.Count(); |
87 |
//ThumbNmailSet(); |
88 |
rdoAllPages.Checked += new RoutedEventHandler(rdoCommented_Checked); |
89 |
rdoFavoritePages.Checked += new RoutedEventHandler(rdoFavoritePages_Checked); |
90 |
expCommentPages.PreviewCollapsed += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewCollapsed); |
91 |
expCommentPages.PreviewExpanded += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewExpanded); |
92 |
} |
93 |
|
94 |
void rdoCommented_Checked(object sender, RoutedEventArgs e) |
95 |
{ |
96 |
Logger.sendCheckLog("rdoCommented_Checked", 1); |
97 |
if (rdoAllPages.IsChecked == true) expCommentPages.IsExpanded = false; |
98 |
SetCommentPages(); |
99 |
} |
100 |
|
101 |
void rdoFavoritePages_Checked(object sender, RoutedEventArgs e) |
102 |
{ |
103 |
Logger.sendCheckLog("rdoFavoritePages_Checked", 1); |
104 |
if (rdoFavoritePages.IsChecked == true) |
105 |
expCommentPages.IsExpanded = false; |
106 |
|
107 |
_FavoriteSet = _FavoriteSet == null ? new List<FAVORITE_DOC>() : _FavoriteSet; |
108 |
if (_FavoriteSet.Count > 0) |
109 |
{ |
110 |
SetCommentPages_Favorite(); //수정 |
111 |
} |
112 |
else |
113 |
{ |
114 |
rdoAllPages.IsChecked = true; |
115 |
rdoFavoritePages.IsChecked = false; |
116 |
} |
117 |
} |
118 |
|
119 |
private void SetCommentPages_Favorite() |
120 |
{ |
121 |
ThumbnailSet(); |
122 |
SetCommentPages(); |
123 |
} |
124 |
|
125 |
void expCommentPages_PreviewCollapsed(object sender, Telerik.Windows.RadRoutedEventArgs e) |
126 |
{ |
127 |
//txtThumbCount.Visibility = Visibility.Collapsed; |
128 |
} |
129 |
|
130 |
void expCommentPages_PreviewExpanded(object sender, Telerik.Windows.RadRoutedEventArgs e) |
131 |
{ |
132 |
Logger.sendCheckLog("expCommentPages_PreviewExpanded", 1); |
133 |
rdoAllPages.IsChecked = false; |
134 |
rdoFavoritePages.IsChecked = false; |
135 |
//txtThumbCount.Visibility = Visibility.Visible; |
136 |
SetCommentPages(); |
137 |
} |
138 |
|
139 |
/// <summary> |
140 |
/// called when image list box's selection is changed |
141 |
/// </summary> |
142 |
/// <param name="sender"></param> |
143 |
/// <param name="e"></param> |
144 |
private void ImgListbox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) |
145 |
{ |
146 |
if (ImgListbox.SelectedItem != null) |
147 |
{ |
148 |
int _CurrentPageNo = -1; |
149 |
if (this.CurrentPage != null) |
150 |
{ |
151 |
this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); /// save controls |
152 |
_CurrentPageNo = this.CurrentPage.PageNumber; |
153 |
} |
154 |
|
155 |
this.CurrentPage = ImgListbox.SelectedItem as ThumbnailItem; |
156 |
int iPageNo = this.CurrentPage.PageNumber; |
157 |
if(_CurrentPageNo != iPageNo) |
158 |
{ |
159 |
PageChanging(this, new PageChangeEventArgs |
160 |
{ |
161 |
CurrentPage = this._PageList.Where(p => p.PAGE_NUMBER == iPageNo).First(), |
162 |
PageNumber = iPageNo, |
163 |
PageUri = null |
164 |
}); |
165 |
} |
166 |
} |
167 |
|
168 |
//var border = VisualTreeHelper.GetChild(ImgListbox, 0); |
169 |
//if (border != null) |
170 |
//{ |
171 |
// IEnumerable<ScrollViewer> scrollViewer = border.ChildrenOfType<ScrollViewer>(); |
172 |
|
173 |
//} |
174 |
//ScrollViewer scrollViewer = (sender as RadListBox) as ScrollViewer; |
175 |
|
176 |
|
177 |
//System.Diagnostics.Debug.WriteLine("page:"+ImgListbox.SelectedIndex); |
178 |
} |
179 |
|
180 |
public bool GotoPageFlag = false; |
181 |
|
182 |
/// <summary> |
183 |
/// 해당 썸네일로 이동 |
184 |
/// </summary> |
185 |
/// <param name="_pageNumber">이동할 페이지 번호</param> |
186 |
public void GotoPage(int _pageNumber) |
187 |
{ |
188 |
try |
189 |
{ |
190 |
var _page = _thumbnailItems.Where(item => item.PageNumber == _pageNumber); |
191 |
if (_page.Count() > 0) |
192 |
{ |
193 |
ThumbnailItem thumbnailitem = _page.First(); |
194 |
if (PageChanging != null) |
195 |
{ |
196 |
var _itemIndex = this._thumbnailItems.IndexOf(thumbnailitem); |
197 |
ImgListbox.SelectedItem = thumbnailitem; |
198 |
//ImgListbox.Items.MoveCurrentTo(thumbnailitem); |
199 |
//if (_itemIndex < _thumbnailItems.Count() - 1) |
200 |
// ImgListbox.ScrollIntoView(_itemIndex); |
201 |
//else |
202 |
// ImgListbox.ScrollIntoView(this._thumbnailItems.Count() - 1); |
203 |
} |
204 |
} |
205 |
} |
206 |
catch(Exception ex) |
207 |
{ |
208 |
Logger.sendResLog("GotoPage", ex.Message, 0); |
209 |
} |
210 |
} |
211 |
|
212 |
/// <summary> |
213 |
/// 주어진 페이지로 변경한다 |
214 |
/// </summary> |
215 |
/// <param name="iPageNo">변경할 페이지 번호</param> |
216 |
public void ChangePage(int iPageNo) |
217 |
{ |
218 |
var thumbitem = this._thumbnailItems.Where(item => item.PageNumber == iPageNo).FirstOrDefault(); |
219 |
if ((PageChanged != null) && (thumbitem != null)) |
220 |
{ |
221 |
var uri = _DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString()); |
222 |
|
223 |
var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber); |
224 |
if (_DocPages.Count() > 0) |
225 |
{ |
226 |
var _page = _DocPages.First(); |
227 |
|
228 |
PageChanged(this, new PageChangeEventArgs |
229 |
{ |
230 |
CurrentPage = _page, |
231 |
PageUri = uri, |
232 |
PageNumber = thumbitem.PageNumber |
233 |
}); |
234 |
//ImgListbox.SelectedItem = thumbitem; |
235 |
//ImgListbox.Items.MoveCurrentTo(thumbitem); |
236 |
|
237 |
this.CurrentPage = thumbitem; |
238 |
} |
239 |
else |
240 |
{ |
241 |
//System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다"); |
242 |
} |
243 |
} |
244 |
} |
245 |
|
246 |
public void GotoPageTALK(int _pageNumber, int _angle) |
247 |
{ |
248 |
int _PageNo = -1; |
249 |
|
250 |
if (int.TryParse(_pageNumber.ToString(), out _PageNo)) |
251 |
{ |
252 |
var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo); |
253 |
if (_page.Count() > 0) |
254 |
{ |
255 |
ThumbnailItem _item = _page.First(); |
256 |
setPageChangeTALK(_item, _angle); |
257 |
this.ImgListbox.SelectedIndex = _pageNumber - 1; |
258 |
//this.ImgListbox.ScrollIntoView(_pageNumber - 1); |
259 |
} |
260 |
} |
261 |
} |
262 |
|
263 |
public void setPageChangeTALK(ThumbnailItem thumbnailItem, int _angle) |
264 |
{ |
265 |
if (thumbnailItem != null) |
266 |
{ |
267 |
if (PageChanging != null) |
268 |
{ |
269 |
///this.CurrentPage = _NextPage; |
270 |
///_NextPage = thumbnailItem; |
271 |
PageChanging(this, new PageChangeEventArgs |
272 |
{ |
273 |
CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(), |
274 |
PageNumber = Convert.ToInt32(thumbnailItem.PageNumber), |
275 |
PageUri = null |
276 |
}); |
277 |
|
278 |
var instanceMain = this.ParentOfType<MainWindow>(); |
279 |
|
280 |
var rotationNum = (_angle - instanceMain.dzMainMenu.rotate.Angle) / 90; |
281 |
|
282 |
if (rotationNum > 0) // 1, 2, 3 |
283 |
{ |
284 |
for (int i = 0; i < rotationNum; i++) |
285 |
{ |
286 |
drawingPannelRotate(true); |
287 |
} |
288 |
} |
289 |
else if (rotationNum < 0)// -1, -2, -3 |
290 |
{ |
291 |
for (int i = 0; i < -rotationNum; i++) |
292 |
{ |
293 |
drawingPannelRotate(false); |
294 |
} |
295 |
} |
296 |
} |
297 |
} |
298 |
} |
299 |
|
300 |
public void drawingPannelRotate(bool Flag) |
301 |
{ |
302 |
var instanceMain = this.ParentOfType<MainWindow>(); |
303 |
|
304 |
if (Flag) |
305 |
{ |
306 |
if (instanceMain.dzMainMenu.rotate.Angle == 270) |
307 |
{ |
308 |
instanceMain.dzMainMenu.rotate.Angle = 0; |
309 |
} |
310 |
else |
311 |
{ |
312 |
instanceMain.dzMainMenu.rotate.Angle += 90; |
313 |
} |
314 |
} |
315 |
else |
316 |
{ |
317 |
if (instanceMain.dzMainMenu.rotate.Angle == 0) |
318 |
{ |
319 |
instanceMain.dzMainMenu.rotate.Angle = 270; |
320 |
} |
321 |
else |
322 |
{ |
323 |
instanceMain.dzMainMenu.rotate.Angle -= 90; |
324 |
} |
325 |
} |
326 |
|
327 |
if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth) |
328 |
{ |
329 |
double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
330 |
instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
331 |
instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize; |
332 |
} |
333 |
|
334 |
if (instanceMain.dzMainMenu.rotate.Angle == 0) |
335 |
{ |
336 |
instanceMain.dzMainMenu.translate.X = 0; |
337 |
instanceMain.dzMainMenu.translate.Y = 0; |
338 |
} |
339 |
else if (instanceMain.dzMainMenu.rotate.Angle == 90) |
340 |
{ |
341 |
instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
342 |
instanceMain.dzMainMenu.translate.Y = 0; |
343 |
} |
344 |
else if (instanceMain.dzMainMenu.rotate.Angle == 180) |
345 |
{ |
346 |
instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
347 |
instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
348 |
} |
349 |
else |
350 |
{ |
351 |
instanceMain.dzMainMenu.translate.X = 0; |
352 |
instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
353 |
} |
354 |
|
355 |
instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle; |
356 |
ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
357 |
ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
358 |
ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X; |
359 |
ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y; |
360 |
ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle; |
361 |
|
362 |
instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data => |
363 |
{ |
364 |
data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString()); |
365 |
|
366 |
instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems; |
367 |
var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault(); |
368 |
instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString()); |
369 |
|
370 |
var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault(); |
371 |
if (rotationdoc != null) |
372 |
{ |
373 |
rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE; |
374 |
} |
375 |
else |
376 |
{ |
377 |
ViewerDataModel.Instance.RotationDocs.Add(instance); |
378 |
} |
379 |
instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber); |
380 |
}); |
381 |
} |
382 |
|
383 |
void lstSelectComment_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) |
384 |
{ |
385 |
SetCommentPages(); |
386 |
} |
387 |
|
388 |
void user_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
389 |
{ |
390 |
SetCommentPages(); |
391 |
//System.Diagnostics.Debug.WriteLine(e.PropertyName); |
392 |
} |
393 |
|
394 |
public void SetCommentPages() |
395 |
{ |
396 |
ThumbnailSet(); |
397 |
SetCommentList(_UsersCommentPagesList.ToList()); |
398 |
} |
399 |
|
400 |
public void SetCommentList(List<UsersCommentPagesMember> UsersCommentPagesList) |
401 |
{ |
402 |
Logger.sendCheckLog("SetCommentList", 1); |
403 |
Logger.sendCheckLog("SetCommentList_기존 Comment 색상 제거", 1); |
404 |
#region 기존 색상 제거 작업 |
405 |
foreach (var item in this._thumbnailItems) |
406 |
{ |
407 |
item.DisplayColorItems.Clear(); |
408 |
} |
409 |
#endregion |
410 |
|
411 |
Logger.sendCheckLog("SetCommentList_delItem select 및 remove", 1); |
412 |
List<UsersCommentPagesMember> _delItem = new List<UsersCommentPagesMember>(); |
413 |
|
414 |
_UsersCommentPagesList.ToList().ForEach(item => |
415 |
{ |
416 |
var _comm = UsersCommentPagesList.Where(a => a.MarkupInfoID == item.MarkupInfoID); |
417 |
|
418 |
if (_comm.Count() == 0) |
419 |
{ |
420 |
_delItem.Add(item); |
421 |
} |
422 |
}); |
423 |
|
424 |
_delItem.ForEach(f => _UsersCommentPagesList.Remove(f)); |
425 |
|
426 |
Logger.sendCheckLog("SetCommentList_UsersCommentPagesMember_PropertyChanged", 1); |
427 |
List<SetColorMarkupItem> setColorMarkupItems = new List<SetColorMarkupItem>(); |
428 |
|
429 |
UsersCommentPagesList.ForEach(user => |
430 |
{ |
431 |
user.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged); |
432 |
user.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged); |
433 |
|
434 |
var _commLst = _UsersCommentPagesList.Where(o => o.MarkupInfoID == user.MarkupInfoID); |
435 |
|
436 |
if (_commLst.Count() == 0) |
437 |
{ |
438 |
_UsersCommentPagesList.Add(user); |
439 |
} |
440 |
else |
441 |
{ |
442 |
if (_commLst.First().PageNumber != user.PageNumber) |
443 |
_commLst.First().PageNumber = user.PageNumber; |
444 |
} |
445 |
|
446 |
user.PageNumber.ForEach(page => |
447 |
{ |
448 |
var _items = this._thumbnailItems.Where(item => item.PageNumber == page); |
449 |
|
450 |
if (_items.Count() > 0) |
451 |
{ |
452 |
setColorMarkupItems.Add(new SetColorMarkupItem { DisplayColor = user.SetColor, markupID = user.MarkupInfoID, Page = page }); |
453 |
|
454 |
} |
455 |
|
456 |
}); |
457 |
}); |
458 |
|
459 |
foreach (var item in this._thumbnailItems) |
460 |
{ |
461 |
item.DisplayColorItems = new ObservableCollection<SetColorMarkupItem>(setColorMarkupItems.Where(color => color.Page == item.PageNumber).ToList()); |
462 |
} |
463 |
|
464 |
Logger.sendCheckLog("SetCommentList_SelectComment.ItemsSource 설정", 1); |
465 |
var data = _UsersCommentPagesList.OrderByDescending(p => p.isConSolidation == Convert.ToInt32(true)).ToList(); |
466 |
if (data.Count() != 0) |
467 |
{ |
468 |
if (Convert.ToBoolean(data.First().isConSolidation)) |
469 |
{ |
470 |
data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().UserName = "Consolidated"; |
471 |
data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().Depart = ""; |
472 |
this.lstSelectComment.ItemsSource = data; |
473 |
} |
474 |
else |
475 |
{ |
476 |
this.lstSelectComment.ItemsSource = _UsersCommentPagesList; //섬네일 |
477 |
} |
478 |
} |
479 |
else |
480 |
{ |
481 |
this.lstSelectComment.ItemsSource = _UsersCommentPagesList; //섬네일 |
482 |
} |
483 |
|
484 |
Logger.sendCheckLog("SetComme6ntList_ImgListbox 설정", 1); |
485 |
|
486 |
|
487 |
//var template = this.ImgListbox.ItemTemplate; |
488 |
//this.ImgListbox.ItemTemplate = null; |
489 |
//this.ImgListbox.ItemTemplate = template; |
490 |
|
491 |
} |
492 |
|
493 |
private void ThumbnailSet() |
494 |
{ |
495 |
Logger.sendCheckLog("ThumbnailSet", 1); |
496 |
if (!_Initialize) return; |
497 |
|
498 |
this._thumbnailItems = new ObservableCollection<ThumbnailItem>(); |
499 |
List<int> _selectComment = new List<int>(); |
500 |
if (this.lstSelectComment.ItemsSource != null) |
501 |
{ |
502 |
var _pages = from commentPage in this.lstSelectComment.ItemsSource.Cast<UsersCommentPagesMember>() |
503 |
where commentPage.IsSelected == true |
504 |
select commentPage.PageNumber; |
505 |
|
506 |
foreach (var item in _pages) |
507 |
{ |
508 |
item.ForEach(pp => _selectComment.Add(pp)); |
509 |
} |
510 |
|
511 |
_selectComment.Distinct(); |
512 |
} |
513 |
|
514 |
var uri = _DefaultUri.Replace("{0}/{1}_{2}", "8/0_0"); |
515 |
this._PageList = this._PageList.OrderBy(data => data.PAGE_NUMBER).ToList(); |
516 |
//this._PageList.ForEach(page => |
517 |
ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page => |
518 |
{ |
519 |
var _pageNo = page.PAGE_NUMBER; |
520 |
bool _addFlag = false; |
521 |
|
522 |
if (rdoFavoritePages.IsChecked == false) |
523 |
{ |
524 |
if (_selectComment.Count() > 0) |
525 |
{ |
526 |
if ((rdoAllPages.IsChecked == true) |
527 |
|| (expCommentPages.IsExpanded == true && _selectComment.Where(s => s == _pageNo).Count() > 0)) |
528 |
{ |
529 |
_addFlag = true; |
530 |
} |
531 |
} |
532 |
else |
533 |
{ |
534 |
//if (App.ViewInfo.IsCustomPage) |
535 |
//{ |
536 |
// //_addFlag = false; |
537 |
|
538 |
// //App.ViewInfo.IsCustomPage = false; |
539 |
// //this.rdoAllPages.Visibility = System.Windows.Visibility.Collapsed; |
540 |
// //this.lstSelectComment.Visibility = System.Windows.Visibility.Collapsed; |
541 |
// this.rdoAllPages.IsChecked = false; |
542 |
// this.rdoFavoritePages.IsChecked = true; |
543 |
// //SetCommentPages(); |
544 |
//} |
545 |
//else |
546 |
//{ |
547 |
_addFlag = true; |
548 |
//} |
549 |
} |
550 |
} |
551 |
|
552 |
|
553 |
if (_addFlag) |
554 |
{ |
555 |
this._thumbnailItems.Add(new ThumbnailItem |
556 |
{ |
557 |
ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
558 |
PageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString()).Replace("jpg","png")), |
559 |
PageNumber = _pageNo, |
560 |
Angle = page.PAGE_ANGLE, |
561 |
}); |
562 |
} |
563 |
else |
564 |
{ |
565 |
if ((rdoFavoritePages.IsChecked == true) && _FavoriteSet.Where(data => data.PAGE_NO == _pageNo).FirstOrDefault() != null) |
566 |
{ |
567 |
this._thumbnailItems.Add(new ThumbnailItem |
568 |
{ |
569 |
ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
570 |
PageNumber = _pageNo, |
571 |
Angle = page.PAGE_ANGLE, |
572 |
}); |
573 |
} |
574 |
} |
575 |
|
576 |
|
577 |
|
578 |
//this._thumbnailItems.Add(new ThumbnailItem |
579 |
//{ |
580 |
// ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
581 |
|
582 |
// //ImageUri = new Uri(@"http://www.honeyhead.net/Pages/000000/111111/11111111/1.cmp"), |
583 |
|
584 |
// //ImageUri = new Uri(@"https://image.freepik.com/free-vector/abstract-logo-in-flame-shape_1043-44.jpg"), |
585 |
// //DisplayColorItems = pageColor, |
586 |
// PageNumber = Convert.ToInt32(_pageNo), |
587 |
// Angle = Convert.ToInt32(page.PAGE_ANGLE), |
588 |
//}); |
589 |
}); |
590 |
|
591 |
//txtTotPageNo.Text = this._PageList.Count().ToString(); |
592 |
|
593 |
//txtThumbCount.Text = String.Format("Count : {0}", (this._thumbnailItems.Count).ToString()); |
594 |
|
595 |
if (ImgListbox.ItemsSource == null) |
596 |
{ |
597 |
ImgListbox.ItemsSource = this._thumbnailItems; |
598 |
|
599 |
this._thumbnailItems.ToList().ForEach(data => |
600 |
{ |
601 |
data.Width = ImgListbox.ActualWidth; |
602 |
data.Height = ImgListbox.ActualHeight; |
603 |
}); |
604 |
|
605 |
if (ImgListbox.Items.Count > 0) |
606 |
{ |
607 |
//int StartPageIdx = Convert.ToInt32(App.ViewInfo.StartPage) - 1; |
608 |
int StartPageIdx = 1; |
609 |
//if (App.ViewInfo.IsCustomPage) |
610 |
//{ |
611 |
// ImgListbox.SelectedItem = ImgListbox.Items.Where(data => (data as ThumbnailItem).PageNumber == Convert.ToInt32(App.ViewInfo.StartPage)).FirstOrDefault(); |
612 |
//} |
613 |
//else |
614 |
//{ |
615 |
|
616 |
if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1) |
617 |
{ |
618 |
ImgListbox.SelectedItem = ImgListbox.Items[0]; |
619 |
} |
620 |
else |
621 |
{ |
622 |
ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx]; |
623 |
} |
624 |
//} |
625 |
} |
626 |
} |
627 |
else |
628 |
{ |
629 |
ImgListbox.UpdateLayout(); |
630 |
ImgListbox.ItemsSource = this._thumbnailItems; |
631 |
} |
632 |
} |
633 |
|
634 |
private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
635 |
{ |
636 |
if (e.ClickCount >= 2) |
637 |
{ |
638 |
var selectItem = MarkupList.SelectedItem as IKCOM.MarkupItem; |
639 |
GotoPage(selectItem.PageNumber); |
640 |
var result = MarkupParser.GetBaseControl(selectItem.Data); |
641 |
Rect rect = new Rect(new Point(result.StartPoint.X - 100, result.StartPoint.Y - 100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100)); |
642 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
643 |
//bool isGO = false; |
644 |
|
645 |
//var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer; |
646 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit; |
647 |
//imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle; |
648 |
//imageViewer.InteractiveUserRectangle += (sen, ea) => |
649 |
//{ |
650 |
// System.Diagnostics.Debug.WriteLine(ea.Bounds); |
651 |
// if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End) |
652 |
// { |
653 |
// this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds); |
654 |
// } |
655 |
|
656 |
//}; |
657 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal; |
658 |
|
659 |
//GotoPage(MarkupList.SelectedItem as MarkupList) |
660 |
} |
661 |
} |
662 |
|
663 |
private void commentUser_SelectionChanged(object sender, SelectionChangedEventArgs e) |
664 |
{ |
665 |
MarkupList.ItemsSource = null; |
666 |
tbSearch.Text = string.Empty; |
667 |
|
668 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
669 |
|
670 |
if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); } |
671 |
|
672 |
if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); } |
673 |
|
674 |
if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); } |
675 |
|
676 |
MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
677 |
} |
678 |
|
679 |
public class MarkupInfoItemSmall |
680 |
{ |
681 |
public string Id { get; set; } |
682 |
public string UserName { get; set; } |
683 |
public string UserID { get; set; } |
684 |
public int PageNumber { get; set; } |
685 |
public string Data { get; set; } |
686 |
public int Data_Type { get; set; } |
687 |
} |
688 |
|
689 |
private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; } |
690 |
public List<MarkupInfoItemSmall> MarkupInfoSmallList |
691 |
{ |
692 |
get |
693 |
{ |
694 |
if (_MarkupInfoSmallList == null) |
695 |
{ |
696 |
_MarkupInfoSmallList = new List<MarkupInfoItemSmall>(); |
697 |
} |
698 |
return _MarkupInfoSmallList; |
699 |
} |
700 |
set |
701 |
{ |
702 |
|
703 |
_MarkupInfoSmallList = value; |
704 |
RaisePropertyChanged("MarkupInfoSmallList"); |
705 |
} |
706 |
} |
707 |
|
708 |
/// <summary> |
709 |
/// goto page and select item selected by user |
710 |
/// </summary> |
711 |
/// <param name="sender"></param> |
712 |
/// <param name="e"></param> |
713 |
private void RadButton_Click(object sender, RoutedEventArgs e) |
714 |
{ |
715 |
var clickButtonItem = sender as RadButton; |
716 |
if (clickButtonItem != null && clickButtonItem.CommandParameter != null) |
717 |
{ |
718 |
try |
719 |
{ |
720 |
Rect rect = new Rect(); |
721 |
Point s_point = new Point(); |
722 |
Point e_point = new Point(); |
723 |
|
724 |
MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall; |
725 |
GotoPage(Convert.ToInt32(gaza.PageNumber)); |
726 |
|
727 |
var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(gaza.Data.ToString()); //언패킹작업 |
728 |
switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString())) |
729 |
{ |
730 |
case MarkupToPDF.Controls.Common.ControlType.TextControl: |
731 |
{ |
732 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
733 |
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)); |
734 |
} |
735 |
break; |
736 |
case MarkupToPDF.Controls.Common.ControlType.TextBorder: |
737 |
{ |
738 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
739 |
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)); |
740 |
} |
741 |
break; |
742 |
case MarkupToPDF.Controls.Common.ControlType.TextCloud: |
743 |
{ |
744 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
745 |
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)); |
746 |
} |
747 |
break; |
748 |
case MarkupToPDF.Controls.Common.ControlType.PolygonControl: |
749 |
{ |
750 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
751 |
|
752 |
foreach (Point A in instance.PointSet) |
753 |
{ |
754 |
if (s_point == new Point()) |
755 |
{ |
756 |
s_point = A; |
757 |
e_point = A; |
758 |
} |
759 |
s_point.X = Math.Min(s_point.X, A.X); |
760 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
761 |
e_point.X = Math.Max(e_point.X, A.X); |
762 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
763 |
} |
764 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
765 |
} |
766 |
break; |
767 |
case MarkupToPDF.Controls.Common.ControlType.PolygonCloud: |
768 |
{ |
769 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
770 |
|
771 |
foreach (Point A in instance.PointSet) |
772 |
{ |
773 |
if (s_point == new Point()) |
774 |
{ |
775 |
s_point = A; |
776 |
e_point = A; |
777 |
} |
778 |
s_point.X = Math.Min(s_point.X, A.X); |
779 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
780 |
e_point.X = Math.Max(e_point.X, A.X); |
781 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
782 |
} |
783 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
784 |
} |
785 |
break; |
786 |
case MarkupToPDF.Controls.Common.ControlType.ChainLine: |
787 |
{ |
788 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
789 |
|
790 |
foreach (Point A in instance.PointSet) |
791 |
{ |
792 |
if (s_point == new Point()) |
793 |
{ |
794 |
s_point = A; |
795 |
e_point = A; |
796 |
} |
797 |
s_point.X = Math.Min(s_point.X, A.X); |
798 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
799 |
e_point.X = Math.Max(e_point.X, A.X); |
800 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
801 |
} |
802 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
803 |
} |
804 |
break; |
805 |
case MarkupToPDF.Controls.Common.ControlType.Ink: |
806 |
{ |
807 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
808 |
|
809 |
foreach (Point A in instance.PointSet) |
810 |
{ |
811 |
if (s_point == new Point()) |
812 |
{ |
813 |
s_point = A; |
814 |
e_point = A; |
815 |
} |
816 |
s_point.X = Math.Min(s_point.X, A.X); |
817 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
818 |
e_point.X = Math.Max(e_point.X, A.X); |
819 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
820 |
} |
821 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
822 |
} |
823 |
break; |
824 |
default: |
825 |
MarkupToPDF.Serialize.S_Control.S_BaseControl item = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
826 |
rect = new Rect(new Point(item.StartPoint.X - 100, item.StartPoint.Y - 100), new Point(item.EndPoint.X + 100, item.EndPoint.Y + 100)); |
827 |
break; |
828 |
} |
829 |
|
830 |
SelectionSet.Instance.SelectItemByRect(rect, this.ParentOfType<KCOM.Views.MainMenu>()); |
831 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
832 |
} |
833 |
catch (Exception ex) |
834 |
{ |
835 |
this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error"); |
836 |
} |
837 |
} |
838 |
} |
839 |
|
840 |
private void MarkupList_Loaded(object sender, RoutedEventArgs e) |
841 |
{ |
842 |
if (MarkupInfoSmallList.Count == 0) |
843 |
{ |
844 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
845 |
{ |
846 |
if (d.MarkupList != null) |
847 |
{ |
848 |
d.MarkupList.ForEach(b => |
849 |
{ |
850 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
851 |
{ |
852 |
Id = b.ID, |
853 |
Data = b.Data, |
854 |
Data_Type = b.Data_Type, |
855 |
PageNumber = b.PageNumber, |
856 |
UserID = d.UserID, |
857 |
UserName = d.UserName, |
858 |
}); |
859 |
}); |
860 |
} |
861 |
}); |
862 |
MarkupList.ItemsSource = null; |
863 |
MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
864 |
|
865 |
commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList(); |
866 |
commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
867 |
} |
868 |
} |
869 |
|
870 |
public void MarkupListUpdate(MarkupReturn res, Event_Type eventType, string CommentID, MarkupInfoItem item) |
871 |
{ |
872 |
if (MarkupInfoSmallList.Count == 0) |
873 |
{ |
874 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
875 |
{ |
876 |
if (d.MarkupList != null) |
877 |
{ |
878 |
d.MarkupList.ForEach(b => |
879 |
{ |
880 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
881 |
{ |
882 |
Id = b.ID, |
883 |
Data = b.Data, |
884 |
Data_Type = b.Data_Type, |
885 |
PageNumber = b.PageNumber, |
886 |
UserID = d.UserID, |
887 |
UserName = d.UserName, |
888 |
}); |
889 |
}); |
890 |
} |
891 |
}); |
892 |
MarkupList.ItemsSource = null; |
893 |
MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
894 |
commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList(); |
895 |
commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
896 |
} |
897 |
|
898 |
switch (eventType) |
899 |
{ |
900 |
case Event_Type.Create: |
901 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
902 |
{ |
903 |
Id = res.CommentID, |
904 |
Data = res.ConvertData, |
905 |
Data_Type = res.DATA_TYPE, |
906 |
PageNumber = CurrentPage.PageNumber, |
907 |
UserID = App.ViewInfo.UserID, |
908 |
UserName = App.UserName, |
909 |
}); |
910 |
break; |
911 |
case Event_Type.Delete: |
912 |
if(CommentID == null) //user information list delete btn |
913 |
{ |
914 |
foreach (var delItem in item.MarkupList) |
915 |
{ |
916 |
MarkupInfoSmallList.RemoveAll(p => p.Id == delItem.ID); |
917 |
} |
918 |
} |
919 |
else //delete, cut, |
920 |
{ |
921 |
MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(CommentID)); |
922 |
} |
923 |
break; |
924 |
case Event_Type.Thumb://이동 회전 |
925 |
MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(res.CommentID)); |
926 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
927 |
{ |
928 |
Id = res.CommentID, |
929 |
Data = res.ConvertData, |
930 |
Data_Type = res.DATA_TYPE, |
931 |
PageNumber = CurrentPage.PageNumber, |
932 |
UserID = App.ViewInfo.UserID, |
933 |
UserName = App.UserName, |
934 |
}); |
935 |
break; |
936 |
default: |
937 |
break; |
938 |
} |
939 |
|
940 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
941 |
if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); } |
942 |
|
943 |
if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); } |
944 |
|
945 |
if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); } |
946 |
|
947 |
MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
948 |
|
949 |
commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
950 |
commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList(); |
951 |
} |
952 |
|
953 |
private void commentType_SelectionChanged(object sender, SelectionChangedEventArgs e) |
954 |
{ |
955 |
MarkupList.ItemsSource = null; |
956 |
tbSearch.Text = string.Empty; |
957 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
958 |
if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); } |
959 |
|
960 |
if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); } |
961 |
|
962 |
if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); } |
963 |
|
964 |
MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
965 |
} |
966 |
|
967 |
private void commentPage_SelectionChanged(object sender, SelectionChangedEventArgs e) |
968 |
{ |
969 |
MarkupList.ItemsSource = null; |
970 |
tbSearch.Text = string.Empty; |
971 |
|
972 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
973 |
if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); } |
974 |
|
975 |
if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); } |
976 |
|
977 |
if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); } |
978 |
|
979 |
MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
980 |
} |
981 |
|
982 |
private void btnPanorama_Click(object sender, RoutedEventArgs e) |
983 |
{ |
984 |
ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow(); |
985 |
} |
986 |
|
987 |
private void btnSearch_Click(object sender, RoutedEventArgs e) |
988 |
{ |
989 |
string search_str = tbSearch.Text; |
990 |
var sel_type = commentType.SelectedItem; |
991 |
var sel_user = commentUser.SelectedItem; |
992 |
var sel_page = commentPage.SelectedItem; |
993 |
List<MarkupInfoItemSmall> small_list = new List<MarkupInfoItemSmall>(); |
994 |
List<MarkupInfoItemSmall> list = MarkupInfoSmallList; |
995 |
if (sel_page != null) |
996 |
{ |
997 |
list = list.Where(d => d.PageNumber == Convert.ToInt32(sel_page)).ToList(); |
998 |
} |
999 |
if (sel_type != null) |
1000 |
{ |
1001 |
list = list.Where(d => d.Data_Type == Convert.ToInt32(sel_type)).ToList(); |
1002 |
} |
1003 |
if (sel_user != null) |
1004 |
{ |
1005 |
list = list.Where(d => d.UserID == (sel_user as MarkupInfoItem).UserID).ToList(); |
1006 |
} |
1007 |
foreach (var item in list) |
1008 |
{ |
1009 |
var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(item.Data.ToString()); |
1010 |
|
1011 |
switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), item.Data_Type.ToString())) |
1012 |
{ |
1013 |
case MarkupToPDF.Controls.Common.ControlType.TextControl: |
1014 |
case MarkupToPDF.Controls.Common.ControlType.TextBorder: |
1015 |
case MarkupToPDF.Controls.Common.ControlType.TextCloud: |
1016 |
{ |
1017 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
1018 |
if (instance.Text.Contains(search_str)) |
1019 |
{ |
1020 |
small_list.Add(item); |
1021 |
} |
1022 |
} |
1023 |
break; |
1024 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl: |
1025 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl: |
1026 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextControl: |
1027 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl: |
1028 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl: |
1029 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl: |
1030 |
{ |
1031 |
MarkupToPDF.Serialize.S_Control.S_ArrowTextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_ArrowTextControl>(data); |
1032 |
if (instance.ArrowText.Contains(search_str)) |
1033 |
{ |
1034 |
small_list.Add(item); |
1035 |
} |
1036 |
} |
1037 |
break; |
1038 |
} |
1039 |
} |
1040 |
|
1041 |
MarkupList.ItemsSource = null; |
1042 |
MarkupList.ItemsSource = small_list.OrderBy(d => d.PageNumber).ToList(); |
1043 |
tbSearch.Text = string.Empty; |
1044 |
} |
1045 |
} |
1046 |
} |