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