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