markus / KCOM / Controls / Sample.xaml.cs @ b200de5a
이력 | 보기 | 이력해설 | 다운로드 (33.5 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 |
//tmStart = false; |
144 |
//tm.Stop(); |
145 |
//tm.Tick -= new EventHandler(tm_Tick); |
146 |
|
147 |
|
148 |
if (ImgListbox.SelectedItem != null) |
149 |
{ |
150 |
int _PageNo = -1; |
151 |
|
152 |
if (this.CurrentPage != null) |
153 |
{ |
154 |
_PageNo = this.CurrentPage.PageNumber; |
155 |
}; |
156 |
|
157 |
if (_PageNo != ((ImgListbox.SelectedItem as ThumbnailItem).PageNumber)) |
158 |
{ |
159 |
|
160 |
GotoPage((ImgListbox.SelectedItem as ThumbnailItem).PageNumber); |
161 |
} |
162 |
} |
163 |
} |
164 |
|
165 |
public bool GotoPageFlag = false; |
166 |
|
167 |
/// <summary> |
168 |
/// 해당 썸네일로 이동 |
169 |
/// </summary> |
170 |
/// <param name="_pageNumber"></param> |
171 |
public void GotoPage(int _pageNumber) |
172 |
{ |
173 |
int _PageNo = -1; |
174 |
if (int.TryParse(_pageNumber.ToString(), out _PageNo)) |
175 |
{ |
176 |
var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo); |
177 |
if (_page.Count() > 0) |
178 |
{ |
179 |
ThumbnailItem _item = _page.First(); |
180 |
setPageChange(_item); |
181 |
if(this.CurrentPage.PageNumber == this.PageCount) |
182 |
{ |
183 |
this.ImgListbox.SelectedIndex = _pageNumber; |
184 |
} |
185 |
} |
186 |
} |
187 |
} |
188 |
|
189 |
public void setPageChange(ThumbnailItem thumbnailItem) |
190 |
{ |
191 |
if (thumbnailItem != null) |
192 |
{ |
193 |
if (PageChanging != null) |
194 |
{ |
195 |
//강인구 수정(페이지가 같을 경우 이동 안함) |
196 |
if (CurrentPage != null && CurrentPage == thumbnailItem) |
197 |
{ |
198 |
return; |
199 |
} |
200 |
CurrentPage = _NextPage; |
201 |
_NextPage = thumbnailItem; |
202 |
PageChanging(this, new PageChangeEventArgs |
203 |
{ |
204 |
CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(), |
205 |
PageNumber = Convert.ToInt32(thumbnailItem.PageNumber), |
206 |
PageUri = null |
207 |
}); |
208 |
} |
209 |
} |
210 |
} |
211 |
public void SetNextPage() |
212 |
{ |
213 |
//if (CurrentPage != null) |
214 |
// System.Diagnostics.Debug.WriteLine("다음페이지 이동 : " + _NextPage.PageNumber + " 이전페이지 : " + CurrentPage.PageNumber); |
215 |
|
216 |
CurrentPage = _NextPage; |
217 |
|
218 |
PageChange(_NextPage); |
219 |
} |
220 |
private void PageChange(ThumbnailItem thumbitem) |
221 |
{ |
222 |
if (PageChanged != null) |
223 |
{ |
224 |
var uri = _DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString()); |
225 |
//var _thumbitem = _thumbnailItems.Where(item => item.PageNumber == DocPage.PageNumber).First(); |
226 |
var _itemIndex = _thumbnailItems.IndexOf(thumbitem); |
227 |
//ImgListbox.SelectedItem(_thumbitem, true); |
228 |
ImgListbox.SelectedItem = thumbitem; |
229 |
|
230 |
if (_itemIndex < _thumbnailItems.Count() - 1) |
231 |
ImgListbox.ScrollIntoView(_itemIndex); |
232 |
else |
233 |
ImgListbox.ScrollIntoView(_thumbnailItems.Count() - 1); |
234 |
|
235 |
//txtCurentPageNo.Text = (_itemIndex + 1).ToString(); |
236 |
|
237 |
//txtCurentPageNo.Text = this.CurrentPage.PageNumber.ToString(); |
238 |
|
239 |
var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber); |
240 |
|
241 |
if (_DocPages.Count() > 0) |
242 |
{ |
243 |
var _page = _DocPages.First(); |
244 |
|
245 |
PageChanged(this, new PageChangeEventArgs |
246 |
{ |
247 |
CurrentPage = _page, |
248 |
PageUri = uri, |
249 |
PageNumber = thumbitem.PageNumber |
250 |
}); |
251 |
ImgListbox.SelectedItem = thumbitem; |
252 |
|
253 |
} |
254 |
else |
255 |
{ |
256 |
System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다"); |
257 |
} |
258 |
} |
259 |
} |
260 |
|
261 |
void lstSelectComment_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) |
262 |
{ |
263 |
SetCommentPages(); |
264 |
} |
265 |
|
266 |
|
267 |
void user_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
268 |
{ |
269 |
SetCommentPages(); |
270 |
System.Diagnostics.Debug.WriteLine(e.PropertyName); |
271 |
} |
272 |
public void SetCommentPages() |
273 |
{ |
274 |
ThumbnailSet(); |
275 |
SetCommentList(_UsersCommentPagesList.ToList()); |
276 |
} |
277 |
|
278 |
public void SetCommentList(List<UsersCommentPagesMember> UsersCommentPagesList) |
279 |
{ |
280 |
#region 기존 색상 제거 작업 |
281 |
foreach (var item in this._thumbnailItems) |
282 |
{ |
283 |
item.DisplayColorItems.Clear(); |
284 |
} |
285 |
#endregion |
286 |
|
287 |
|
288 |
|
289 |
List<UsersCommentPagesMember> _delItem = new List<UsersCommentPagesMember>(); |
290 |
|
291 |
_UsersCommentPagesList.ToList().ForEach(item => |
292 |
{ |
293 |
var _comm = UsersCommentPagesList.Where(a => a.MarkupInfoID == item.MarkupInfoID); |
294 |
|
295 |
if (_comm.Count() == 0) |
296 |
{ |
297 |
_delItem.Add(item); |
298 |
} |
299 |
}); |
300 |
|
301 |
_delItem.ForEach(f => _UsersCommentPagesList.Remove(f)); |
302 |
|
303 |
UsersCommentPagesList.ForEach(user => |
304 |
{ |
305 |
user.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged); |
306 |
user.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged); |
307 |
|
308 |
var _commLst = _UsersCommentPagesList.Where(o => o.MarkupInfoID == user.MarkupInfoID); |
309 |
|
310 |
if (_commLst.Count() == 0) |
311 |
{ |
312 |
_UsersCommentPagesList.Add(user); |
313 |
} |
314 |
else |
315 |
{ |
316 |
if (_commLst.First().PageNumber != user.PageNumber) |
317 |
_commLst.First().PageNumber = user.PageNumber; |
318 |
} |
319 |
|
320 |
user.PageNumber.ForEach(page => |
321 |
{ |
322 |
var _items = this._thumbnailItems.Where(item => item.PageNumber == page); |
323 |
|
324 |
if (_items.Count() > 0) |
325 |
_items.First().DisplayColorItems.Add(new SetColorMarkupItem { DisplayColor = user.SetColor }); |
326 |
}); |
327 |
}); |
328 |
|
329 |
|
330 |
|
331 |
var data = _UsersCommentPagesList.OrderByDescending(p => p.isConSolidation == Convert.ToInt32(true)).ToList(); |
332 |
if (data.Count() != 0) |
333 |
{ |
334 |
if (Convert.ToBoolean(data.First().isConSolidation)) |
335 |
{ |
336 |
data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().UserName = "Consolidated"; |
337 |
data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().Depart = ""; |
338 |
this.lstSelectComment.ItemsSource = data; |
339 |
} |
340 |
else |
341 |
{ |
342 |
this.lstSelectComment.ItemsSource = _UsersCommentPagesList; //섬네일 |
343 |
} |
344 |
} |
345 |
else |
346 |
{ |
347 |
this.lstSelectComment.ItemsSource = _UsersCommentPagesList; //섬네일 |
348 |
} |
349 |
//this.ImgListbox.ItemsSource = null; |
350 |
this.ImgListbox.ItemsSource = this._thumbnailItems; |
351 |
var template = this.ImgListbox.ItemTemplate; |
352 |
this.ImgListbox.ItemTemplate = null; |
353 |
this.ImgListbox.ItemTemplate = template; |
354 |
this.ImgListbox.UpdateLayout(); |
355 |
} |
356 |
|
357 |
private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
358 |
{ |
359 |
|
360 |
} |
361 |
private void ThumbnailSet() |
362 |
{ |
363 |
if (!_Initialize) return; |
364 |
|
365 |
this._thumbnailItems = new ObservableCollection<ThumbnailItem>(); |
366 |
List<int> _selectComment = new List<int>(); |
367 |
if (this.lstSelectComment.ItemsSource != null) |
368 |
{ |
369 |
var _pages = from commentPage in this.lstSelectComment.ItemsSource.Cast<UsersCommentPagesMember>() |
370 |
where commentPage.IsSelected == true |
371 |
select commentPage.PageNumber; |
372 |
|
373 |
foreach (var item in _pages) |
374 |
{ |
375 |
item.ForEach(pp => _selectComment.Add(pp)); |
376 |
} |
377 |
|
378 |
_selectComment.Distinct(); |
379 |
} |
380 |
|
381 |
var uri = _DefaultUri.Replace("{0}/{1}_{2}", "8/0_0"); |
382 |
this._PageList = this._PageList.OrderBy(data => data.PAGE_NUMBER).ToList(); |
383 |
//this._PageList.ForEach(page => |
384 |
ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page => |
385 |
{ |
386 |
var _pageNo = page.PAGE_NUMBER; |
387 |
bool _addFlag = false; |
388 |
|
389 |
if (rdoFavoritePages.IsChecked == false) |
390 |
{ |
391 |
if (_selectComment.Count() > 0) |
392 |
{ |
393 |
if ((rdoAllPages.IsChecked == true) |
394 |
|| (expCommentPages.IsExpanded == true && _selectComment.Where(s => s == _pageNo).Count() > 0)) |
395 |
{ |
396 |
_addFlag = true; |
397 |
} |
398 |
} |
399 |
else |
400 |
{ |
401 |
//if (App.ViewInfo.IsCustomPage) |
402 |
//{ |
403 |
// //_addFlag = false; |
404 |
|
405 |
// //App.ViewInfo.IsCustomPage = false; |
406 |
// //this.rdoAllPages.Visibility = System.Windows.Visibility.Collapsed; |
407 |
// //this.lstSelectComment.Visibility = System.Windows.Visibility.Collapsed; |
408 |
// this.rdoAllPages.IsChecked = false; |
409 |
// this.rdoFavoritePages.IsChecked = true; |
410 |
// //SetCommentPages(); |
411 |
//} |
412 |
//else |
413 |
//{ |
414 |
_addFlag = true; |
415 |
//} |
416 |
} |
417 |
} |
418 |
|
419 |
|
420 |
if(_addFlag) |
421 |
{ |
422 |
this._thumbnailItems.Add(new ThumbnailItem |
423 |
{ |
424 |
ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
425 |
PageNumber = _pageNo, |
426 |
Angle = page.PAGE_ANGLE, |
427 |
}); |
428 |
} |
429 |
else |
430 |
{ |
431 |
if ((rdoFavoritePages.IsChecked == true) && _FavoriteSet.Where(data => data.PAGE_NO == _pageNo).FirstOrDefault() != null) |
432 |
{ |
433 |
this._thumbnailItems.Add(new ThumbnailItem |
434 |
{ |
435 |
ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
436 |
PageNumber = _pageNo, |
437 |
Angle = page.PAGE_ANGLE, |
438 |
}); |
439 |
} |
440 |
} |
441 |
|
442 |
|
443 |
|
444 |
//this._thumbnailItems.Add(new ThumbnailItem |
445 |
//{ |
446 |
// ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
447 |
|
448 |
// //ImageUri = new Uri(@"http://www.honeyhead.net/Pages/000000/111111/11111111/1.cmp"), |
449 |
|
450 |
// //ImageUri = new Uri(@"https://image.freepik.com/free-vector/abstract-logo-in-flame-shape_1043-44.jpg"), |
451 |
// //DisplayColorItems = pageColor, |
452 |
// PageNumber = Convert.ToInt32(_pageNo), |
453 |
// Angle = Convert.ToInt32(page.PAGE_ANGLE), |
454 |
//}); |
455 |
}); |
456 |
|
457 |
//txtTotPageNo.Text = this._PageList.Count().ToString(); |
458 |
|
459 |
//txtThumbCount.Text = String.Format("Count : {0}", (this._thumbnailItems.Count).ToString()); |
460 |
|
461 |
if (ImgListbox.ItemsSource == null) |
462 |
{ |
463 |
ImgListbox.ItemsSource = this._thumbnailItems; |
464 |
|
465 |
this._thumbnailItems.ToList().ForEach(data => |
466 |
{ |
467 |
data.Width = ImgListbox.ActualWidth; |
468 |
}); |
469 |
|
470 |
if (ImgListbox.Items.Count > 0) |
471 |
{ |
472 |
//int StartPageIdx = Convert.ToInt32(App.ViewInfo.StartPage) - 1; |
473 |
int StartPageIdx = 1; |
474 |
//if (App.ViewInfo.IsCustomPage) |
475 |
//{ |
476 |
// ImgListbox.SelectedItem = ImgListbox.Items.Where(data => (data as ThumbnailItem).PageNumber == Convert.ToInt32(App.ViewInfo.StartPage)).FirstOrDefault(); |
477 |
//} |
478 |
//else |
479 |
//{ |
480 |
|
481 |
if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1) |
482 |
{ |
483 |
ImgListbox.SelectedItem = ImgListbox.Items[0]; |
484 |
} |
485 |
else |
486 |
{ |
487 |
ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx]; |
488 |
} |
489 |
//} |
490 |
} |
491 |
} |
492 |
else |
493 |
{ |
494 |
ImgListbox.UpdateLayout(); |
495 |
ImgListbox.ItemsSource = this._thumbnailItems; |
496 |
} |
497 |
} |
498 |
|
499 |
private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
500 |
{ |
501 |
if (e.ClickCount >= 2) |
502 |
{ |
503 |
var selectItem = gogogo.SelectedItem as IKCOM.MarkupItem; |
504 |
GotoPage(selectItem.PageNumber); |
505 |
MarkupToPDF.Controls.Parsing.LayerControl control = new MarkupToPDF.Controls.Parsing.LayerControl(); |
506 |
var result = control.markupParse_GetBaseControl(selectItem.Data); |
507 |
Rect rect = new Rect(new Point(result.StartPoint.X-100, result.StartPoint.Y-100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100)); |
508 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
509 |
//bool isGO = false; |
510 |
|
511 |
//var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer; |
512 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit; |
513 |
//imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle; |
514 |
//imageViewer.InteractiveUserRectangle += (sen, ea) => |
515 |
//{ |
516 |
// System.Diagnostics.Debug.WriteLine(ea.Bounds); |
517 |
// if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End) |
518 |
// { |
519 |
// this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds); |
520 |
// } |
521 |
|
522 |
//}; |
523 |
//imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal; |
524 |
|
525 |
//GotoPage(gogogo.SelectedItem as MarkupList) |
526 |
} |
527 |
} |
528 |
|
529 |
private void commentUser_SelectionChanged(object sender, SelectionChangedEventArgs e) |
530 |
{ |
531 |
if (e.AddedItems.Count > 0) |
532 |
{ |
533 |
if (commentUser.Items.Count > 0) |
534 |
{ |
535 |
MarkupInfoSmallList.Clear(); |
536 |
//var d = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList.First(); |
537 |
//d.PageNumber |
538 |
|
539 |
//e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList.First(). |
540 |
//gogo.DataContext = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList; |
541 |
|
542 |
//gogogo.ItemsSource = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList; |
543 |
//gogogo.ItemsSource = ViewerDataModel.Instance._markupInfoList.Where(d=>d.UserName == sender as RadCombo |
544 |
|
545 |
var temp = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault(); |
546 |
temp.MarkupList.ForEach(d => |
547 |
{ |
548 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
549 |
{ |
550 |
Data = d.Data, |
551 |
Data_Type = d.Data_Type, |
552 |
PageNumber = d.PageNumber, |
553 |
UserID = temp.UserID, |
554 |
UserName = temp.UserName, |
555 |
}); |
556 |
}); |
557 |
gogogo.ItemsSource = null; |
558 |
gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
559 |
} |
560 |
} |
561 |
else |
562 |
{ |
563 |
MarkupInfoSmallList.Clear(); |
564 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
565 |
{ |
566 |
d.MarkupList.ForEach(b => |
567 |
{ |
568 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
569 |
{ |
570 |
|
571 |
Data = b.Data, |
572 |
Data_Type = b.Data_Type, |
573 |
PageNumber = b.PageNumber, |
574 |
UserID = d.UserID, |
575 |
UserName = d.UserName, |
576 |
}); |
577 |
}); |
578 |
}); |
579 |
gogogo.ItemsSource = null; |
580 |
gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
581 |
} |
582 |
} |
583 |
|
584 |
public class MarkupInfoItemSmall |
585 |
{ |
586 |
public string Id { get; set; } |
587 |
public string UserName { get; set; } |
588 |
public string UserID { get; set; } |
589 |
public int PageNumber { get; set; } |
590 |
public string Data { get; set; } |
591 |
public int Data_Type { get; set; } |
592 |
} |
593 |
|
594 |
private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; } |
595 |
public List<MarkupInfoItemSmall> MarkupInfoSmallList |
596 |
{ |
597 |
get |
598 |
{ |
599 |
if (_MarkupInfoSmallList == null) |
600 |
{ |
601 |
_MarkupInfoSmallList = new List<MarkupInfoItemSmall>(); |
602 |
} |
603 |
return _MarkupInfoSmallList; |
604 |
} |
605 |
set |
606 |
{ |
607 |
|
608 |
_MarkupInfoSmallList = value; |
609 |
RaisePropertyChanged("MarkupInfoSmallList"); |
610 |
} |
611 |
} |
612 |
|
613 |
|
614 |
|
615 |
private void RadButton_Click(object sender, RoutedEventArgs e) |
616 |
{ |
617 |
var clickButtonItem = sender as RadButton; |
618 |
if (clickButtonItem != null && clickButtonItem.CommandParameter != null) |
619 |
{ |
620 |
try |
621 |
{ |
622 |
Rect rect = new Rect(); |
623 |
Point s_point = new Point(); |
624 |
Point e_point = new Point(); |
625 |
|
626 |
MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall; |
627 |
GotoPage(Convert.ToInt32(gaza.PageNumber)); |
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>().zoomAndPanControl.ZoomTo(rect); |
732 |
} |
733 |
catch (Exception ex) |
734 |
{ |
735 |
throw; |
736 |
} |
737 |
|
738 |
|
739 |
} |
740 |
} |
741 |
|
742 |
private void gogogo_Loaded(object sender, RoutedEventArgs e) |
743 |
{ |
744 |
if (MarkupInfoSmallList.Count == 0) |
745 |
{ |
746 |
ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
747 |
{ |
748 |
if (d.MarkupList != null) |
749 |
{ |
750 |
d.MarkupList.ForEach(b => |
751 |
{ |
752 |
MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
753 |
{ |
754 |
Id = b.ID, |
755 |
Data = b.Data, |
756 |
Data_Type = b.Data_Type, |
757 |
PageNumber = b.PageNumber, |
758 |
UserID = d.UserID, |
759 |
UserName = d.UserName, |
760 |
}); |
761 |
}); |
762 |
} |
763 |
}); |
764 |
gogogo.ItemsSource = null; |
765 |
gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); ; |
766 |
|
767 |
commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d=>d).ToList(); |
768 |
commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
769 |
} |
770 |
} |
771 |
|
772 |
private void commentType_SelectionChanged(object sender, SelectionChangedEventArgs e) |
773 |
{ |
774 |
gogogo.ItemsSource = null; |
775 |
if (e.AddedItems.Count >0) |
776 |
{ |
777 |
|
778 |
gogogo.ItemsSource = MarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(e.AddedItems[0])).ToList(); |
779 |
} |
780 |
else |
781 |
{ |
782 |
gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
783 |
} |
784 |
} |
785 |
|
786 |
private void commentPage_SelectionChanged(object sender, SelectionChangedEventArgs e) |
787 |
{ |
788 |
gogogo.ItemsSource = null; |
789 |
if (e.AddedItems.Count > 0) |
790 |
{ |
791 |
gogogo.ItemsSource = MarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(e.AddedItems[0])).ToList(); |
792 |
} |
793 |
else |
794 |
{ |
795 |
gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
796 |
} |
797 |
} |
798 |
|
799 |
private void btnPanorama_Click(object sender, RoutedEventArgs e) |
800 |
{ |
801 |
ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow(); |
802 |
} |
803 |
} |
804 |
} |