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