markus / KCOM / Controls / Sample.xaml.cs @ cdfb57ff
이력 | 보기 | 이력해설 | 다운로드 (46.7 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 |
PageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString()).Replace("jpg","png")), |
546 |
PageNumber = _pageNo, |
547 |
Angle = page.PAGE_ANGLE, |
548 |
}); |
549 |
} |
550 |
else |
551 |
{ |
552 |
if ((rdoFavoritePages.IsChecked == true) && _FavoriteSet.Where(data => data.PAGE_NO == _pageNo).FirstOrDefault() != null) |
553 |
{ |
554 |
this._thumbnailItems.Add(new ThumbnailItem |
555 |
{ |
556 |
ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
557 |
PageNumber = _pageNo, |
558 |
Angle = page.PAGE_ANGLE, |
559 |
}); |
560 |
} |
561 |
} |
562 |
|
563 |
|
564 |
|
565 |
//this._thumbnailItems.Add(new ThumbnailItem |
566 |
//{ |
567 |
// ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
568 |
|
569 |
// //ImageUri = new Uri(@"http://www.honeyhead.net/Pages/000000/111111/11111111/1.cmp"), |
570 |
|
571 |
// //ImageUri = new Uri(@"https://image.freepik.com/free-vector/abstract-logo-in-flame-shape_1043-44.jpg"), |
572 |
// //DisplayColorItems = pageColor, |
573 |
// PageNumber = Convert.ToInt32(_pageNo), |
574 |
// Angle = Convert.ToInt32(page.PAGE_ANGLE), |
575 |
//}); |
576 |
}); |
577 |
|
578 |
//txtTotPageNo.Text = this._PageList.Count().ToString(); |
579 |
|
580 |
//txtThumbCount.Text = String.Format("Count : {0}", (this._thumbnailItems.Count).ToString()); |
581 |
|
582 |
if (ImgListbox.ItemsSource == null) |
583 |
{ |
584 |
ImgListbox.ItemsSource = this._thumbnailItems; |
585 |
|
586 |
this._thumbnailItems.ToList().ForEach(data => |
587 |
{ |
588 |
data.Width = ImgListbox.ActualWidth; |
589 |
data.Height = ImgListbox.ActualHeight; |
590 |
}); |
591 |
|
592 |
if (ImgListbox.Items.Count > 0) |
593 |
{ |
594 |
//int StartPageIdx = Convert.ToInt32(App.ViewInfo.StartPage) - 1; |
595 |
int StartPageIdx = 1; |
596 |
//if (App.ViewInfo.IsCustomPage) |
597 |
//{ |
598 |
// ImgListbox.SelectedItem = ImgListbox.Items.Where(data => (data as ThumbnailItem).PageNumber == Convert.ToInt32(App.ViewInfo.StartPage)).FirstOrDefault(); |
599 |
//} |
600 |
//else |
601 |
//{ |
602 |
|
603 |
if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1) |
604 |
{ |
605 |
ImgListbox.SelectedItem = ImgListbox.Items[0]; |
606 |
} |
607 |
else |
608 |
{ |
609 |
ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx]; |
610 |
} |
611 |
//} |
612 |
} |
613 |
} |
614 |
else |
615 |
{ |
616 |
ImgListbox.UpdateLayout(); |
617 |
ImgListbox.ItemsSource = this._thumbnailItems; |
618 |
} |
619 |
} |
620 |
|
621 |
private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
622 |
{ |
623 |
if (e.ClickCount >= 2) |
624 |
{ |
625 |
var selectItem = MarkupList.SelectedItem as IKCOM.MarkupItem; |
626 |
GotoPage(selectItem.PageNumber); |
627 |
var result = MarkupParser.GetBaseControl(selectItem.Data); |
628 |
Rect rect = new Rect(new Point(result.StartPoint.X - 100, result.StartPoint.Y - 100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100)); |
629 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
630 |
//bool isGO = false; |
631 |
|
632 |
//var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer; |
633 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit; |
634 |
//imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle; |
635 |
//imageViewer.InteractiveUserRectangle += (sen, ea) => |
636 |
//{ |
637 |
// System.Diagnostics.Debug.WriteLine(ea.Bounds); |
638 |
// if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End) |
639 |
// { |
640 |
// this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds); |
641 |
// } |
642 |
|
643 |
//}; |
644 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal; |
645 |
|
646 |
//GotoPage(MarkupList.SelectedItem as MarkupList) |
647 |
} |
648 |
} |
649 |
|
650 |
private void commentUser_SelectionChanged(object sender, SelectionChangedEventArgs e) |
651 |
{ |
652 |
MarkupList.ItemsSource = null; |
653 |
tbSearch.Text = string.Empty; |
654 |
|
655 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
656 |
|
657 |
if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); } |
658 |
|
659 |
if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); } |
660 |
|
661 |
if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); } |
662 |
|
663 |
MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
664 |
} |
665 |
|
666 |
public class MarkupInfoItemSmall |
667 |
{ |
668 |
public string Id { get; set; } |
669 |
public string UserName { get; set; } |
670 |
public string UserID { get; set; } |
671 |
public int PageNumber { get; set; } |
672 |
public string Data { get; set; } |
673 |
public int Data_Type { get; set; } |
674 |
} |
675 |
|
676 |
private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; } |
677 |
public List<MarkupInfoItemSmall> MarkupInfoSmallList |
678 |
{ |
679 |
get |
680 |
{ |
681 |
if (_MarkupInfoSmallList == null) |
682 |
{ |
683 |
_MarkupInfoSmallList = new List<MarkupInfoItemSmall>(); |
684 |
} |
685 |
return _MarkupInfoSmallList; |
686 |
} |
687 |
set |
688 |
{ |
689 |
|
690 |
_MarkupInfoSmallList = value; |
691 |
RaisePropertyChanged("MarkupInfoSmallList"); |
692 |
} |
693 |
} |
694 |
|
695 |
/// <summary> |
696 |
/// goto page and select item selected by user |
697 |
/// </summary> |
698 |
/// <param name="sender"></param> |
699 |
/// <param name="e"></param> |
700 |
private void RadButton_Click(object sender, RoutedEventArgs e) |
701 |
{ |
702 |
var clickButtonItem = sender as RadButton; |
703 |
if (clickButtonItem != null && clickButtonItem.CommandParameter != null) |
704 |
{ |
705 |
try |
706 |
{ |
707 |
Rect rect = new Rect(); |
708 |
Point s_point = new Point(); |
709 |
Point e_point = new Point(); |
710 |
|
711 |
MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall; |
712 |
GotoPage(Convert.ToInt32(gaza.PageNumber)); |
713 |
|
714 |
var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(gaza.Data.ToString()); //언패킹작업 |
715 |
switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString())) |
716 |
{ |
717 |
case MarkupToPDF.Controls.Common.ControlType.TextControl: |
718 |
{ |
719 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
720 |
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)); |
721 |
} |
722 |
break; |
723 |
case MarkupToPDF.Controls.Common.ControlType.TextBorder: |
724 |
{ |
725 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
726 |
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)); |
727 |
} |
728 |
break; |
729 |
case MarkupToPDF.Controls.Common.ControlType.TextCloud: |
730 |
{ |
731 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
732 |
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)); |
733 |
} |
734 |
break; |
735 |
case MarkupToPDF.Controls.Common.ControlType.PolygonControl: |
736 |
{ |
737 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
738 |
|
739 |
foreach (Point A in instance.PointSet) |
740 |
{ |
741 |
if (s_point == new Point()) |
742 |
{ |
743 |
s_point = A; |
744 |
e_point = A; |
745 |
} |
746 |
s_point.X = Math.Min(s_point.X, A.X); |
747 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
748 |
e_point.X = Math.Max(e_point.X, A.X); |
749 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
750 |
} |
751 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
752 |
} |
753 |
break; |
754 |
case MarkupToPDF.Controls.Common.ControlType.PolygonCloud: |
755 |
{ |
756 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
757 |
|
758 |
foreach (Point A in instance.PointSet) |
759 |
{ |
760 |
if (s_point == new Point()) |
761 |
{ |
762 |
s_point = A; |
763 |
e_point = A; |
764 |
} |
765 |
s_point.X = Math.Min(s_point.X, A.X); |
766 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
767 |
e_point.X = Math.Max(e_point.X, A.X); |
768 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
769 |
} |
770 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
771 |
} |
772 |
break; |
773 |
case MarkupToPDF.Controls.Common.ControlType.ChainLine: |
774 |
{ |
775 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
776 |
|
777 |
foreach (Point A in instance.PointSet) |
778 |
{ |
779 |
if (s_point == new Point()) |
780 |
{ |
781 |
s_point = A; |
782 |
e_point = A; |
783 |
} |
784 |
s_point.X = Math.Min(s_point.X, A.X); |
785 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
786 |
e_point.X = Math.Max(e_point.X, A.X); |
787 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
788 |
} |
789 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
790 |
} |
791 |
break; |
792 |
case MarkupToPDF.Controls.Common.ControlType.Ink: |
793 |
{ |
794 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
795 |
|
796 |
foreach (Point A in instance.PointSet) |
797 |
{ |
798 |
if (s_point == new Point()) |
799 |
{ |
800 |
s_point = A; |
801 |
e_point = A; |
802 |
} |
803 |
s_point.X = Math.Min(s_point.X, A.X); |
804 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
805 |
e_point.X = Math.Max(e_point.X, A.X); |
806 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
807 |
} |
808 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
809 |
} |
810 |
break; |
811 |
default: |
812 |
MarkupToPDF.Serialize.S_Control.S_BaseControl item = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
813 |
rect = new Rect(new Point(item.StartPoint.X - 100, item.StartPoint.Y - 100), new Point(item.EndPoint.X + 100, item.EndPoint.Y + 100)); |
814 |
break; |
815 |
} |
816 |
|
817 |
SelectionSet.Instance.SelectItemByRect(rect, this.ParentOfType<KCOM.Views.MainMenu>()); |
818 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
819 |
} |
820 |
catch (Exception ex) |
821 |
{ |
822 |
this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error"); |
823 |
} |
824 |
} |
825 |
} |
826 |
|
827 |
private void MarkupList_Loaded(object sender, RoutedEventArgs e) |
828 |
{ |
829 |
if (MarkupInfoSmallList.Count == 0) |
830 |
{ |
831 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
832 |
{ |
833 |
if (d.MarkupList != null) |
834 |
{ |
835 |
d.MarkupList.ForEach(b => |
836 |
{ |
837 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
838 |
{ |
839 |
Id = b.ID, |
840 |
Data = b.Data, |
841 |
Data_Type = b.Data_Type, |
842 |
PageNumber = b.PageNumber, |
843 |
UserID = d.UserID, |
844 |
UserName = d.UserName, |
845 |
}); |
846 |
}); |
847 |
} |
848 |
}); |
849 |
MarkupList.ItemsSource = null; |
850 |
MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
851 |
|
852 |
commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList(); |
853 |
commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
854 |
} |
855 |
} |
856 |
|
857 |
public void MarkupListUpdate(MarkupReturn res, Event_Type eventType, string CommentID, MarkupInfoItem item) |
858 |
{ |
859 |
if (MarkupInfoSmallList.Count == 0) |
860 |
{ |
861 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
862 |
{ |
863 |
if (d.MarkupList != null) |
864 |
{ |
865 |
d.MarkupList.ForEach(b => |
866 |
{ |
867 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
868 |
{ |
869 |
Id = b.ID, |
870 |
Data = b.Data, |
871 |
Data_Type = b.Data_Type, |
872 |
PageNumber = b.PageNumber, |
873 |
UserID = d.UserID, |
874 |
UserName = d.UserName, |
875 |
}); |
876 |
}); |
877 |
} |
878 |
}); |
879 |
MarkupList.ItemsSource = null; |
880 |
MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
881 |
commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList(); |
882 |
commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
883 |
} |
884 |
|
885 |
switch (eventType) |
886 |
{ |
887 |
case Event_Type.Create: |
888 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
889 |
{ |
890 |
Id = res.CommentID, |
891 |
Data = res.ConvertData, |
892 |
Data_Type = res.DATA_TYPE, |
893 |
PageNumber = CurrentPage.PageNumber, |
894 |
UserID = App.ViewInfo.UserID, |
895 |
UserName = App.UserName, |
896 |
}); |
897 |
break; |
898 |
case Event_Type.Delete: |
899 |
if(CommentID == null) //user information list delete btn |
900 |
{ |
901 |
foreach (var delItem in item.MarkupList) |
902 |
{ |
903 |
MarkupInfoSmallList.RemoveAll(p => p.Id == delItem.ID); |
904 |
} |
905 |
} |
906 |
else //delete, cut, |
907 |
{ |
908 |
MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(CommentID)); |
909 |
} |
910 |
break; |
911 |
case Event_Type.Thumb://이동 회전 |
912 |
MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(res.CommentID)); |
913 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
914 |
{ |
915 |
Id = res.CommentID, |
916 |
Data = res.ConvertData, |
917 |
Data_Type = res.DATA_TYPE, |
918 |
PageNumber = CurrentPage.PageNumber, |
919 |
UserID = App.ViewInfo.UserID, |
920 |
UserName = App.UserName, |
921 |
}); |
922 |
break; |
923 |
default: |
924 |
break; |
925 |
} |
926 |
|
927 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
928 |
if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); } |
929 |
|
930 |
if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); } |
931 |
|
932 |
if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); } |
933 |
|
934 |
MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
935 |
|
936 |
commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
937 |
commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList(); |
938 |
} |
939 |
|
940 |
private void commentType_SelectionChanged(object sender, SelectionChangedEventArgs e) |
941 |
{ |
942 |
MarkupList.ItemsSource = null; |
943 |
tbSearch.Text = string.Empty; |
944 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
945 |
if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); } |
946 |
|
947 |
if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); } |
948 |
|
949 |
if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); } |
950 |
|
951 |
MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
952 |
} |
953 |
|
954 |
private void commentPage_SelectionChanged(object sender, SelectionChangedEventArgs e) |
955 |
{ |
956 |
MarkupList.ItemsSource = null; |
957 |
tbSearch.Text = string.Empty; |
958 |
|
959 |
List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
960 |
if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); } |
961 |
|
962 |
if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); } |
963 |
|
964 |
if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); } |
965 |
|
966 |
MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
967 |
} |
968 |
|
969 |
private void btnPanorama_Click(object sender, RoutedEventArgs e) |
970 |
{ |
971 |
ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow(); |
972 |
} |
973 |
|
974 |
private void btnSearch_Click(object sender, RoutedEventArgs e) |
975 |
{ |
976 |
string search_str = tbSearch.Text; |
977 |
var sel_type = commentType.SelectedItem; |
978 |
var sel_user = commentUser.SelectedItem; |
979 |
var sel_page = commentPage.SelectedItem; |
980 |
List<MarkupInfoItemSmall> small_list = new List<MarkupInfoItemSmall>(); |
981 |
List<MarkupInfoItemSmall> list = MarkupInfoSmallList; |
982 |
if (sel_page != null) |
983 |
{ |
984 |
list = list.Where(d => d.PageNumber == Convert.ToInt32(sel_page)).ToList(); |
985 |
} |
986 |
if (sel_type != null) |
987 |
{ |
988 |
list = list.Where(d => d.Data_Type == Convert.ToInt32(sel_type)).ToList(); |
989 |
} |
990 |
if (sel_user != null) |
991 |
{ |
992 |
list = list.Where(d => d.UserID == (sel_user as MarkupInfoItem).UserID).ToList(); |
993 |
} |
994 |
foreach (var item in list) |
995 |
{ |
996 |
var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(item.Data.ToString()); |
997 |
|
998 |
switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), item.Data_Type.ToString())) |
999 |
{ |
1000 |
case MarkupToPDF.Controls.Common.ControlType.TextControl: |
1001 |
case MarkupToPDF.Controls.Common.ControlType.TextBorder: |
1002 |
case MarkupToPDF.Controls.Common.ControlType.TextCloud: |
1003 |
{ |
1004 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
1005 |
if (instance.Text.Contains(search_str)) |
1006 |
{ |
1007 |
small_list.Add(item); |
1008 |
} |
1009 |
} |
1010 |
break; |
1011 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl: |
1012 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl: |
1013 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTextControl: |
1014 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl: |
1015 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl: |
1016 |
case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl: |
1017 |
{ |
1018 |
MarkupToPDF.Serialize.S_Control.S_ArrowTextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_ArrowTextControl>(data); |
1019 |
if (instance.ArrowText.Contains(search_str)) |
1020 |
{ |
1021 |
small_list.Add(item); |
1022 |
} |
1023 |
} |
1024 |
break; |
1025 |
} |
1026 |
} |
1027 |
|
1028 |
MarkupList.ItemsSource = null; |
1029 |
MarkupList.ItemsSource = small_list.OrderBy(d => d.PageNumber).ToList(); |
1030 |
tbSearch.Text = string.Empty; |
1031 |
} |
1032 |
} |
1033 |
} |