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