markus / KCOM / Controls / Sample.xaml.cs @ 3d425b19
이력 | 보기 | 이력해설 | 다운로드 (33.8 KB)
1 |
using IKCOM; |
---|---|
2 |
using KCOM.Common; |
3 |
using KCOMDataModel.DataModel; |
4 |
using System; |
5 |
using System.Collections.Generic; |
6 |
using System.Collections.ObjectModel; |
7 |
using System.ComponentModel; |
8 |
using System.Linq; |
9 |
using System.Windows; |
10 |
using System.Windows.Controls; |
11 |
using System.Windows.Input; |
12 |
using Telerik.Windows.Controls; |
13 |
|
14 |
namespace KCOM.Controls |
15 |
{ |
16 |
/// <summary> |
17 |
/// Interaction logic for PageNavigator.xaml |
18 |
/// </summary> |
19 |
public partial class Sample : UserControl, INotifyPropertyChanged |
20 |
{ |
21 |
public List<FAVORITE_DOC> _FavoriteSet { get; set; } |
22 |
public event PropertyChangedEventHandler PropertyChanged; |
23 |
public Sample() |
24 |
{ |
25 |
InitializeComponent(); |
26 |
_Initialize = true; |
27 |
|
28 |
lstSelectComment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(lstSelectComment_SelectionChanged); |
29 |
//ImgListbox.MouseDoubleClick += ImgListbox_MouseDoubleClick; |
30 |
} |
31 |
|
32 |
//private void ImgListbox_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
33 |
//{ |
34 |
|
35 |
// if (ImgListbox.SelectedItem !=null && (ImgListbox.SelectedItem as ThumbnailItem).PageNumber == CurrentPage.PageNumber) |
36 |
// { |
37 |
// this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ScaleToFit(); |
38 |
// } |
39 |
//} |
40 |
|
41 |
public ObservableCollection<ThumbnailItem> _thumbnailItems; |
42 |
private List<DOCPAGE> _PageList = null; |
43 |
private string _DefaultUri = null; |
44 |
public ThumbnailItem CurrentPage = null; |
45 |
public ThumbnailItem _NextPage = null; |
46 |
public int PageCount = 0; |
47 |
|
48 |
private bool _Initialize; |
49 |
public event EventHandler<PageChangeEventArgs> PageChanged; |
50 |
public event EventHandler<PageChangeEventArgs> PageChanging; |
51 |
List<UsersCommentPagesMember> _UsersCommentPagesList = new List<UsersCommentPagesMember>(); |
52 |
public class PageChangeEventArgs : EventArgs |
53 |
{ |
54 |
public DOCPAGE CurrentPage { get; set; } |
55 |
public string PageUri { get; set; } |
56 |
public int PageNumber { get; set; } |
57 |
} |
58 |
|
59 |
private bool _IsFitOn { get; set; } |
60 |
public bool IsFitOn |
61 |
{ |
62 |
get |
63 |
{ |
64 |
return _IsFitOn; |
65 |
} |
66 |
set |
67 |
{ |
68 |
_IsFitOn = value; |
69 |
RaisePropertyChanged("IsFitOn"); |
70 |
} |
71 |
} |
72 |
|
73 |
public void RaisePropertyChanged(string propName) |
74 |
{ |
75 |
if (PropertyChanged != null) |
76 |
PropertyChanged(this, new PropertyChangedEventArgs(propName)); |
77 |
} |
78 |
|
79 |
public void SetPageNavi(List<DOCPAGE> PageList, string DefaultUri) |
80 |
{ |
81 |
this._PageList = PageList; |
82 |
this._DefaultUri = DefaultUri; |
83 |
ThumbnailSet(); |
84 |
this.PageCount = PageList.Count(); |
85 |
//ThumbNmailSet(); |
86 |
rdoAllPages.Checked += new RoutedEventHandler(rdoCommented_Checked); |
87 |
rdoFavoritePages.Checked += new RoutedEventHandler(rdoFavoritePages_Checked); |
88 |
expCommentPages.PreviewCollapsed += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewCollapsed); |
89 |
expCommentPages.PreviewExpanded += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewExpanded); |
90 |
} |
91 |
void rdoCommented_Checked(object sender, RoutedEventArgs e) |
92 |
{ |
93 |
if (rdoAllPages.IsChecked == true) expCommentPages.IsExpanded = false; |
94 |
SetCommentPages(); |
95 |
} |
96 |
|
97 |
void rdoFavoritePages_Checked(object sender, RoutedEventArgs e) |
98 |
{ |
99 |
if (rdoFavoritePages.IsChecked == true) |
100 |
expCommentPages.IsExpanded = false; |
101 |
|
102 |
_FavoriteSet = _FavoriteSet == null ? new List<FAVORITE_DOC>() : _FavoriteSet; |
103 |
if (_FavoriteSet.Count > 0) |
104 |
{ |
105 |
SetCommentPages_Favorite(); //수정 |
106 |
} |
107 |
else |
108 |
{ |
109 |
rdoAllPages.IsChecked = true; |
110 |
rdoFavoritePages.IsChecked = false; |
111 |
} |
112 |
} |
113 |
|
114 |
private void SetCommentPages_Favorite() |
115 |
{ |
116 |
ThumbnailSet(); |
117 |
//_UsersCommentPagesList |
118 |
//var result = (from A in _UsersCommentPagesList |
119 |
// from B in _FavoriteSet |
120 |
// where A.PageNumber.Contains(B.PageNo) |
121 |
// select A).ToList(); |
122 |
//_UsersCommentPagesList = result; |
123 |
|
124 |
SetCommentPages(); |
125 |
|
126 |
} |
127 |
|
128 |
void expCommentPages_PreviewCollapsed(object sender, Telerik.Windows.RadRoutedEventArgs e) |
129 |
{ |
130 |
//txtThumbCount.Visibility = Visibility.Collapsed; |
131 |
} |
132 |
|
133 |
void expCommentPages_PreviewExpanded(object sender, Telerik.Windows.RadRoutedEventArgs e) |
134 |
{ |
135 |
rdoAllPages.IsChecked = false; |
136 |
rdoFavoritePages.IsChecked = false; |
137 |
//txtThumbCount.Visibility = Visibility.Visible; |
138 |
SetCommentPages(); |
139 |
} |
140 |
|
141 |
private void ImgListbox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) |
142 |
{ |
143 |
if (ImgListbox.SelectedItem != null) |
144 |
{ |
145 |
int _PageNo = -1; |
146 |
|
147 |
if (this.CurrentPage != null) |
148 |
{ |
149 |
_PageNo = this.CurrentPage.PageNumber; |
150 |
}; |
151 |
|
152 |
if (_PageNo != ((ImgListbox.SelectedItem as ThumbnailItem).PageNumber)) |
153 |
{ |
154 |
var _page = this._thumbnailItems.Where(item => item.PageNumber == (ImgListbox.SelectedItem as ThumbnailItem).PageNumber); |
155 |
if (_page.Count() > 0) |
156 |
{ |
157 |
ThumbnailItem _item = _page.First(); |
158 |
setPageChange(_item); |
159 |
} |
160 |
} |
161 |
} |
162 |
} |
163 |
|
164 |
public bool GotoPageFlag = false; |
165 |
|
166 |
/// <summary> |
167 |
/// 해당 썸네일로 이동 |
168 |
/// </summary> |
169 |
/// <param name="_pageNumber"></param> |
170 |
public void GotoPage(int _pageNumber) |
171 |
{ |
172 |
int _PageNo = -1; |
173 |
if (int.TryParse(_pageNumber.ToString(), out _PageNo)) |
174 |
{ |
175 |
var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo); |
176 |
if (_page.Count() > 0) |
177 |
{ |
178 |
ThumbnailItem _item = _page.First(); |
179 |
setPageChange(_item); |
180 |
this.ImgListbox.SelectedIndex = _pageNumber - 1; |
181 |
this.ImgListbox.ScrollIntoView(_pageNumber - 1); |
182 |
} |
183 |
} |
184 |
} |
185 |
|
186 |
public void setPageChange(ThumbnailItem thumbnailItem) |
187 |
{ |
188 |
if (thumbnailItem != null) |
189 |
{ |
190 |
if (PageChanging != null) |
191 |
{ |
192 |
//강인구 수정(페이지가 같을 경우 이동 안함) |
193 |
if (CurrentPage != null && CurrentPage == thumbnailItem) |
194 |
{ |
195 |
return; |
196 |
} |
197 |
|
198 |
this.CurrentPage = _NextPage; |
199 |
_NextPage = thumbnailItem; |
200 |
PageChanging(this, new PageChangeEventArgs |
201 |
{ |
202 |
CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(), |
203 |
PageNumber = Convert.ToInt32(thumbnailItem.PageNumber), |
204 |
PageUri = null |
205 |
}); |
206 |
} |
207 |
} |
208 |
} |
209 |
|
210 |
public void SetNextPage() |
211 |
{ |
212 |
CurrentPage = _NextPage; |
213 |
PageChange(_NextPage); |
214 |
} |
215 |
|
216 |
private void PageChange(ThumbnailItem thumbitem) |
217 |
{ |
218 |
if (PageChanged != null) |
219 |
{ |
220 |
var uri = _DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString()); |
221 |
//var _thumbitem = _thumbnailItems.Where(item => item.PageNumber == DocPage.PageNumber).First(); |
222 |
var _itemIndex = _thumbnailItems.IndexOf(thumbitem); |
223 |
//ImgListbox.SelectedItem(_thumbitem, true); |
224 |
ImgListbox.SelectedItem = thumbitem; |
225 |
|
226 |
if (_itemIndex < _thumbnailItems.Count() - 1) |
227 |
ImgListbox.ScrollIntoView(_itemIndex); |
228 |
else |
229 |
ImgListbox.ScrollIntoView(_thumbnailItems.Count() - 1); |
230 |
|
231 |
//txtCurentPageNo.Text = (_itemIndex + 1).ToString(); |
232 |
|
233 |
//txtCurentPageNo.Text = this.CurrentPage.PageNumber.ToString(); |
234 |
|
235 |
var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber); |
236 |
|
237 |
if (_DocPages.Count() > 0) |
238 |
{ |
239 |
var _page = _DocPages.First(); |
240 |
|
241 |
PageChanged(this, new PageChangeEventArgs |
242 |
{ |
243 |
CurrentPage = _page, |
244 |
PageUri = uri, |
245 |
PageNumber = thumbitem.PageNumber |
246 |
}); |
247 |
ImgListbox.SelectedItem = thumbitem; |
248 |
|
249 |
} |
250 |
else |
251 |
{ |
252 |
//System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다"); |
253 |
} |
254 |
} |
255 |
} |
256 |
|
257 |
void lstSelectComment_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) |
258 |
{ |
259 |
SetCommentPages(); |
260 |
} |
261 |
|
262 |
|
263 |
void user_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
264 |
{ |
265 |
SetCommentPages(); |
266 |
//System.Diagnostics.Debug.WriteLine(e.PropertyName); |
267 |
} |
268 |
public void SetCommentPages() |
269 |
{ |
270 |
ThumbnailSet(); |
271 |
SetCommentList(_UsersCommentPagesList.ToList()); |
272 |
} |
273 |
|
274 |
public void SetCommentList(List<UsersCommentPagesMember> UsersCommentPagesList) |
275 |
{ |
276 |
#region 기존 색상 제거 작업 |
277 |
foreach (var item in this._thumbnailItems) |
278 |
{ |
279 |
item.DisplayColorItems.Clear(); |
280 |
} |
281 |
#endregion |
282 |
|
283 |
|
284 |
|
285 |
List<UsersCommentPagesMember> _delItem = new List<UsersCommentPagesMember>(); |
286 |
|
287 |
_UsersCommentPagesList.ToList().ForEach(item => |
288 |
{ |
289 |
var _comm = UsersCommentPagesList.Where(a => a.MarkupInfoID == item.MarkupInfoID); |
290 |
|
291 |
if (_comm.Count() == 0) |
292 |
{ |
293 |
_delItem.Add(item); |
294 |
} |
295 |
}); |
296 |
|
297 |
_delItem.ForEach(f => _UsersCommentPagesList.Remove(f)); |
298 |
|
299 |
UsersCommentPagesList.ForEach(user => |
300 |
{ |
301 |
user.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged); |
302 |
user.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged); |
303 |
|
304 |
var _commLst = _UsersCommentPagesList.Where(o => o.MarkupInfoID == user.MarkupInfoID); |
305 |
|
306 |
if (_commLst.Count() == 0) |
307 |
{ |
308 |
_UsersCommentPagesList.Add(user); |
309 |
} |
310 |
else |
311 |
{ |
312 |
if (_commLst.First().PageNumber != user.PageNumber) |
313 |
_commLst.First().PageNumber = user.PageNumber; |
314 |
} |
315 |
|
316 |
user.PageNumber.ForEach(page => |
317 |
{ |
318 |
var _items = this._thumbnailItems.Where(item => item.PageNumber == page); |
319 |
|
320 |
if (_items.Count() > 0) |
321 |
_items.First().DisplayColorItems.Add(new SetColorMarkupItem { DisplayColor = user.SetColor }); |
322 |
}); |
323 |
}); |
324 |
|
325 |
|
326 |
|
327 |
var data = _UsersCommentPagesList.OrderByDescending(p => p.isConSolidation == Convert.ToInt32(true)).ToList(); |
328 |
if (data.Count() != 0) |
329 |
{ |
330 |
if (Convert.ToBoolean(data.First().isConSolidation)) |
331 |
{ |
332 |
data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().UserName = "Consolidated"; |
333 |
data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().Depart = ""; |
334 |
this.lstSelectComment.ItemsSource = data; |
335 |
} |
336 |
else |
337 |
{ |
338 |
this.lstSelectComment.ItemsSource = _UsersCommentPagesList; //섬네일 |
339 |
} |
340 |
} |
341 |
else |
342 |
{ |
343 |
this.lstSelectComment.ItemsSource = _UsersCommentPagesList; //섬네일 |
344 |
} |
345 |
//this.ImgListbox.ItemsSource = null; |
346 |
this.ImgListbox.ItemsSource = this._thumbnailItems; |
347 |
var template = this.ImgListbox.ItemTemplate; |
348 |
this.ImgListbox.ItemTemplate = null; |
349 |
this.ImgListbox.ItemTemplate = template; |
350 |
this.ImgListbox.UpdateLayout(); |
351 |
} |
352 |
|
353 |
private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
354 |
{ |
355 |
|
356 |
} |
357 |
private void ThumbnailSet() |
358 |
{ |
359 |
if (!_Initialize) return; |
360 |
|
361 |
this._thumbnailItems = new ObservableCollection<ThumbnailItem>(); |
362 |
List<int> _selectComment = new List<int>(); |
363 |
if (this.lstSelectComment.ItemsSource != null) |
364 |
{ |
365 |
var _pages = from commentPage in this.lstSelectComment.ItemsSource.Cast<UsersCommentPagesMember>() |
366 |
where commentPage.IsSelected == true |
367 |
select commentPage.PageNumber; |
368 |
|
369 |
foreach (var item in _pages) |
370 |
{ |
371 |
item.ForEach(pp => _selectComment.Add(pp)); |
372 |
} |
373 |
|
374 |
_selectComment.Distinct(); |
375 |
} |
376 |
|
377 |
var uri = _DefaultUri.Replace("{0}/{1}_{2}", "8/0_0"); |
378 |
this._PageList = this._PageList.OrderBy(data => data.PAGE_NUMBER).ToList(); |
379 |
//this._PageList.ForEach(page => |
380 |
ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page => |
381 |
{ |
382 |
var _pageNo = page.PAGE_NUMBER; |
383 |
bool _addFlag = false; |
384 |
|
385 |
if (rdoFavoritePages.IsChecked == false) |
386 |
{ |
387 |
if (_selectComment.Count() > 0) |
388 |
{ |
389 |
if ((rdoAllPages.IsChecked == true) |
390 |
|| (expCommentPages.IsExpanded == true && _selectComment.Where(s => s == _pageNo).Count() > 0)) |
391 |
{ |
392 |
_addFlag = true; |
393 |
} |
394 |
} |
395 |
else |
396 |
{ |
397 |
//if (App.ViewInfo.IsCustomPage) |
398 |
//{ |
399 |
// //_addFlag = false; |
400 |
|
401 |
// //App.ViewInfo.IsCustomPage = false; |
402 |
// //this.rdoAllPages.Visibility = System.Windows.Visibility.Collapsed; |
403 |
// //this.lstSelectComment.Visibility = System.Windows.Visibility.Collapsed; |
404 |
// this.rdoAllPages.IsChecked = false; |
405 |
// this.rdoFavoritePages.IsChecked = true; |
406 |
// //SetCommentPages(); |
407 |
//} |
408 |
//else |
409 |
//{ |
410 |
_addFlag = true; |
411 |
//} |
412 |
} |
413 |
} |
414 |
|
415 |
|
416 |
if(_addFlag) |
417 |
{ |
418 |
this._thumbnailItems.Add(new ThumbnailItem |
419 |
{ |
420 |
ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
421 |
PageNumber = _pageNo, |
422 |
Angle = page.PAGE_ANGLE, |
423 |
}); |
424 |
} |
425 |
else |
426 |
{ |
427 |
if ((rdoFavoritePages.IsChecked == true) && _FavoriteSet.Where(data => data.PAGE_NO == _pageNo).FirstOrDefault() != null) |
428 |
{ |
429 |
this._thumbnailItems.Add(new ThumbnailItem |
430 |
{ |
431 |
ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
432 |
PageNumber = _pageNo, |
433 |
Angle = page.PAGE_ANGLE, |
434 |
}); |
435 |
} |
436 |
} |
437 |
|
438 |
|
439 |
|
440 |
//this._thumbnailItems.Add(new ThumbnailItem |
441 |
//{ |
442 |
// ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
443 |
|
444 |
// //ImageUri = new Uri(@"http://www.honeyhead.net/Pages/000000/111111/11111111/1.cmp"), |
445 |
|
446 |
// //ImageUri = new Uri(@"https://image.freepik.com/free-vector/abstract-logo-in-flame-shape_1043-44.jpg"), |
447 |
// //DisplayColorItems = pageColor, |
448 |
// PageNumber = Convert.ToInt32(_pageNo), |
449 |
// Angle = Convert.ToInt32(page.PAGE_ANGLE), |
450 |
//}); |
451 |
}); |
452 |
|
453 |
//txtTotPageNo.Text = this._PageList.Count().ToString(); |
454 |
|
455 |
//txtThumbCount.Text = String.Format("Count : {0}", (this._thumbnailItems.Count).ToString()); |
456 |
|
457 |
if (ImgListbox.ItemsSource == null) |
458 |
{ |
459 |
ImgListbox.ItemsSource = this._thumbnailItems; |
460 |
|
461 |
this._thumbnailItems.ToList().ForEach(data => |
462 |
{ |
463 |
data.Width = ImgListbox.ActualWidth; |
464 |
}); |
465 |
|
466 |
if (ImgListbox.Items.Count > 0) |
467 |
{ |
468 |
//int StartPageIdx = Convert.ToInt32(App.ViewInfo.StartPage) - 1; |
469 |
int StartPageIdx = 1; |
470 |
//if (App.ViewInfo.IsCustomPage) |
471 |
//{ |
472 |
// ImgListbox.SelectedItem = ImgListbox.Items.Where(data => (data as ThumbnailItem).PageNumber == Convert.ToInt32(App.ViewInfo.StartPage)).FirstOrDefault(); |
473 |
//} |
474 |
//else |
475 |
//{ |
476 |
|
477 |
if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1) |
478 |
{ |
479 |
ImgListbox.SelectedItem = ImgListbox.Items[0]; |
480 |
} |
481 |
else |
482 |
{ |
483 |
ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx]; |
484 |
} |
485 |
//} |
486 |
} |
487 |
} |
488 |
else |
489 |
{ |
490 |
ImgListbox.UpdateLayout(); |
491 |
ImgListbox.ItemsSource = this._thumbnailItems; |
492 |
} |
493 |
} |
494 |
|
495 |
private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
496 |
{ |
497 |
if (e.ClickCount >= 2) |
498 |
{ |
499 |
var selectItem = gogogo.SelectedItem as IKCOM.MarkupItem; |
500 |
GotoPage(selectItem.PageNumber); |
501 |
MarkupToPDF.Controls.Parsing.LayerControl control = new MarkupToPDF.Controls.Parsing.LayerControl(); |
502 |
var result = control.markupParse_GetBaseControl(selectItem.Data); |
503 |
Rect rect = new Rect(new Point(result.StartPoint.X-100, result.StartPoint.Y-100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100)); |
504 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
505 |
//bool isGO = false; |
506 |
|
507 |
//var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer; |
508 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit; |
509 |
//imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle; |
510 |
//imageViewer.InteractiveUserRectangle += (sen, ea) => |
511 |
//{ |
512 |
// System.Diagnostics.Debug.WriteLine(ea.Bounds); |
513 |
// if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End) |
514 |
// { |
515 |
// this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds); |
516 |
// } |
517 |
|
518 |
//}; |
519 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal; |
520 |
|
521 |
//GotoPage(gogogo.SelectedItem as MarkupList) |
522 |
} |
523 |
} |
524 |
|
525 |
private void commentUser_SelectionChanged(object sender, SelectionChangedEventArgs e) |
526 |
{ |
527 |
if (e.AddedItems.Count > 0) |
528 |
{ |
529 |
if (commentUser.Items.Count > 0) |
530 |
{ |
531 |
MarkupInfoSmallList.Clear(); |
532 |
//var d = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList.First(); |
533 |
//d.PageNumber |
534 |
|
535 |
//e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList.First(). |
536 |
//gogo.DataContext = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList; |
537 |
|
538 |
//gogogo.ItemsSource = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList; |
539 |
//gogogo.ItemsSource = ViewerDataModel.Instance._markupInfoList.Where(d=>d.UserName == sender as RadCombo |
540 |
|
541 |
var temp = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault(); |
542 |
temp.MarkupList.ForEach(d => |
543 |
{ |
544 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
545 |
{ |
546 |
Data = d.Data, |
547 |
Data_Type = d.Data_Type, |
548 |
PageNumber = d.PageNumber, |
549 |
UserID = temp.UserID, |
550 |
UserName = temp.UserName, |
551 |
}); |
552 |
}); |
553 |
gogogo.ItemsSource = null; |
554 |
gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
555 |
} |
556 |
} |
557 |
else |
558 |
{ |
559 |
MarkupInfoSmallList.Clear(); |
560 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
561 |
{ |
562 |
d.MarkupList.ForEach(b => |
563 |
{ |
564 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
565 |
{ |
566 |
|
567 |
Data = b.Data, |
568 |
Data_Type = b.Data_Type, |
569 |
PageNumber = b.PageNumber, |
570 |
UserID = d.UserID, |
571 |
UserName = d.UserName, |
572 |
}); |
573 |
}); |
574 |
}); |
575 |
gogogo.ItemsSource = null; |
576 |
gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
577 |
} |
578 |
} |
579 |
|
580 |
public class MarkupInfoItemSmall |
581 |
{ |
582 |
public string Id { get; set; } |
583 |
public string UserName { get; set; } |
584 |
public string UserID { get; set; } |
585 |
public int PageNumber { get; set; } |
586 |
public string Data { get; set; } |
587 |
public int Data_Type { get; set; } |
588 |
} |
589 |
|
590 |
private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; } |
591 |
public List<MarkupInfoItemSmall> MarkupInfoSmallList |
592 |
{ |
593 |
get |
594 |
{ |
595 |
if (_MarkupInfoSmallList == null) |
596 |
{ |
597 |
_MarkupInfoSmallList = new List<MarkupInfoItemSmall>(); |
598 |
} |
599 |
return _MarkupInfoSmallList; |
600 |
} |
601 |
set |
602 |
{ |
603 |
|
604 |
_MarkupInfoSmallList = value; |
605 |
RaisePropertyChanged("MarkupInfoSmallList"); |
606 |
} |
607 |
} |
608 |
|
609 |
/// <summary> |
610 |
/// goto page and select item selected by user |
611 |
/// </summary> |
612 |
/// <param name="sender"></param> |
613 |
/// <param name="e"></param> |
614 |
private void RadButton_Click(object sender, RoutedEventArgs e) |
615 |
{ |
616 |
var clickButtonItem = sender as RadButton; |
617 |
if (clickButtonItem != null && clickButtonItem.CommandParameter != null) |
618 |
{ |
619 |
try |
620 |
{ |
621 |
Rect rect = new Rect(); |
622 |
Point s_point = new Point(); |
623 |
Point e_point = new Point(); |
624 |
|
625 |
MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall; |
626 |
GotoPage(Convert.ToInt32(gaza.PageNumber)); |
627 |
|
628 |
var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(gaza.Data.ToString()); //언패킹작업 |
629 |
switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString())) |
630 |
{ |
631 |
case MarkupToPDF.Controls.Common.ControlType.TextControl: |
632 |
{ |
633 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
634 |
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)); |
635 |
} |
636 |
break; |
637 |
case MarkupToPDF.Controls.Common.ControlType.TextBorder: |
638 |
{ |
639 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
640 |
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)); |
641 |
} |
642 |
break; |
643 |
case MarkupToPDF.Controls.Common.ControlType.TextCloud: |
644 |
{ |
645 |
MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
646 |
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)); |
647 |
} |
648 |
break; |
649 |
case MarkupToPDF.Controls.Common.ControlType.PolygonControl: |
650 |
{ |
651 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
652 |
|
653 |
foreach (Point A in instance.PointSet) |
654 |
{ |
655 |
if (s_point == new Point()) |
656 |
{ |
657 |
s_point = A; |
658 |
e_point = A; |
659 |
} |
660 |
s_point.X = Math.Min(s_point.X, A.X); |
661 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
662 |
e_point.X = Math.Max(e_point.X, A.X); |
663 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
664 |
} |
665 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
666 |
} |
667 |
break; |
668 |
case MarkupToPDF.Controls.Common.ControlType.PolygonCloud: |
669 |
{ |
670 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
671 |
|
672 |
foreach (Point A in instance.PointSet) |
673 |
{ |
674 |
if (s_point == new Point()) |
675 |
{ |
676 |
s_point = A; |
677 |
e_point = A; |
678 |
} |
679 |
s_point.X = Math.Min(s_point.X, A.X); |
680 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
681 |
e_point.X = Math.Max(e_point.X, A.X); |
682 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
683 |
} |
684 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
685 |
} |
686 |
break; |
687 |
case MarkupToPDF.Controls.Common.ControlType.ChainLine: |
688 |
{ |
689 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
690 |
|
691 |
foreach (Point A in instance.PointSet) |
692 |
{ |
693 |
if (s_point == new Point()) |
694 |
{ |
695 |
s_point = A; |
696 |
e_point = A; |
697 |
} |
698 |
s_point.X = Math.Min(s_point.X, A.X); |
699 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
700 |
e_point.X = Math.Max(e_point.X, A.X); |
701 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
702 |
} |
703 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
704 |
} |
705 |
break; |
706 |
case MarkupToPDF.Controls.Common.ControlType.Ink: |
707 |
{ |
708 |
MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
709 |
|
710 |
foreach (Point A in instance.PointSet) |
711 |
{ |
712 |
if (s_point == new Point()) |
713 |
{ |
714 |
s_point = A; |
715 |
e_point = A; |
716 |
} |
717 |
s_point.X = Math.Min(s_point.X, A.X); |
718 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
719 |
e_point.X = Math.Max(e_point.X, A.X); |
720 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
721 |
} |
722 |
rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
723 |
} |
724 |
break; |
725 |
default: |
726 |
MarkupToPDF.Serialize.S_Control.S_BaseControl item = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
727 |
rect = new Rect(new Point(item.StartPoint.X - 100, item.StartPoint.Y - 100), new Point(item.EndPoint.X + 100, item.EndPoint.Y + 100)); |
728 |
break; |
729 |
} |
730 |
|
731 |
this.ParentOfType<KCOM.Views.MainMenu>().SelecteItemByRect(rect); |
732 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
733 |
} |
734 |
catch (Exception ex) |
735 |
{ |
736 |
this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error"); |
737 |
} |
738 |
} |
739 |
} |
740 |
|
741 |
private void gogogo_Loaded(object sender, RoutedEventArgs e) |
742 |
{ |
743 |
if (MarkupInfoSmallList.Count == 0) |
744 |
{ |
745 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
746 |
{ |
747 |
if (d.MarkupList != null) |
748 |
{ |
749 |
d.MarkupList.ForEach(b => |
750 |
{ |
751 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
752 |
{ |
753 |
Id = b.ID, |
754 |
Data = b.Data, |
755 |
Data_Type = b.Data_Type, |
756 |
PageNumber = b.PageNumber, |
757 |
UserID = d.UserID, |
758 |
UserName = d.UserName, |
759 |
}); |
760 |
}); |
761 |
} |
762 |
}); |
763 |
gogogo.ItemsSource = null; |
764 |
gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); ; |
765 |
|
766 |
commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d=>d).ToList(); |
767 |
commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
768 |
} |
769 |
} |
770 |
|
771 |
private void commentType_SelectionChanged(object sender, SelectionChangedEventArgs e) |
772 |
{ |
773 |
gogogo.ItemsSource = null; |
774 |
if (e.AddedItems.Count >0) |
775 |
{ |
776 |
|
777 |
gogogo.ItemsSource = MarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(e.AddedItems[0])).ToList(); |
778 |
} |
779 |
else |
780 |
{ |
781 |
gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
782 |
} |
783 |
} |
784 |
|
785 |
private void commentPage_SelectionChanged(object sender, SelectionChangedEventArgs e) |
786 |
{ |
787 |
gogogo.ItemsSource = null; |
788 |
if (e.AddedItems.Count > 0) |
789 |
{ |
790 |
gogogo.ItemsSource = MarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(e.AddedItems[0])).ToList(); |
791 |
} |
792 |
else |
793 |
{ |
794 |
gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
795 |
} |
796 |
} |
797 |
|
798 |
private void btnPanorama_Click(object sender, RoutedEventArgs e) |
799 |
{ |
800 |
ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow(); |
801 |
} |
802 |
} |
803 |
} |