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