markus / KCOM / Controls / Sample.xaml.cs @ 548c696e
이력 | 보기 | 이력해설 | 다운로드 (45.5 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 | 0c997b99 | ljiyeon | using System.Diagnostics; |
9 | 787a4489 | KangIngu | using System.Linq; |
10 | using System.Windows; |
||
11 | using System.Windows.Controls; |
||
12 | using System.Windows.Input; |
||
13 | using Telerik.Windows.Controls; |
||
14 | |||
15 | namespace KCOM.Controls |
||
16 | { |
||
17 | /// <summary> |
||
18 | /// Interaction logic for PageNavigator.xaml |
||
19 | /// </summary> |
||
20 | public partial class Sample : UserControl, INotifyPropertyChanged |
||
21 | { |
||
22 | 992a98b4 | KangIngu | public List<FAVORITE_DOC> _FavoriteSet { get; set; } |
23 | 787a4489 | KangIngu | public event PropertyChangedEventHandler PropertyChanged; |
24 | public Sample() |
||
25 | { |
||
26 | 0c997b99 | ljiyeon | //InitializeComponent(); |
27 | this.Loaded += Sample_Loaded; |
||
28 | //_Initialize = true; |
||
29 | |||
30 | //lstSelectComment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(lstSelectComment_SelectionChanged); |
||
31 | //ImgListbox.MouseDoubleClick += ImgListbox_MouseDoubleClick; |
||
32 | } |
||
33 | |||
34 | private void Sample_Loaded(object sender, RoutedEventArgs e) |
||
35 | { |
||
36 | //측정 |
||
37 | //Stopwatch sw = new Stopwatch(); |
||
38 | //sw.Start(); |
||
39 | 787a4489 | KangIngu | InitializeComponent(); |
40 | 0c997b99 | ljiyeon | //System.Diagnostics.Debug.WriteLine("Sample() : " + sw.ElapsedMilliseconds.ToString() + "ms"); |
41 | |||
42 | 787a4489 | KangIngu | _Initialize = true; |
43 | lstSelectComment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(lstSelectComment_SelectionChanged); |
||
44 | 0c997b99 | ljiyeon | |
45 | 787a4489 | KangIngu | } |
46 | |||
47 | //private void ImgListbox_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
||
48 | //{ |
||
49 | |||
50 | // if (ImgListbox.SelectedItem !=null && (ImgListbox.SelectedItem as ThumbnailItem).PageNumber == CurrentPage.PageNumber) |
||
51 | // { |
||
52 | // this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ScaleToFit(); |
||
53 | // } |
||
54 | //} |
||
55 | |||
56 | public ObservableCollection<ThumbnailItem> _thumbnailItems; |
||
57 | private List<DOCPAGE> _PageList = null; |
||
58 | private string _DefaultUri = null; |
||
59 | public ThumbnailItem CurrentPage = null; |
||
60 | public ThumbnailItem _NextPage = null; |
||
61 | public int PageCount = 0; |
||
62 | |||
63 | private bool _Initialize; |
||
64 | public event EventHandler<PageChangeEventArgs> PageChanged; |
||
65 | public event EventHandler<PageChangeEventArgs> PageChanging; |
||
66 | List<UsersCommentPagesMember> _UsersCommentPagesList = new List<UsersCommentPagesMember>(); |
||
67 | public class PageChangeEventArgs : EventArgs |
||
68 | { |
||
69 | public DOCPAGE CurrentPage { get; set; } |
||
70 | public string PageUri { get; set; } |
||
71 | public int PageNumber { get; set; } |
||
72 | } |
||
73 | |||
74 | private bool _IsFitOn { get; set; } |
||
75 | public bool IsFitOn |
||
76 | { |
||
77 | get |
||
78 | { |
||
79 | return _IsFitOn; |
||
80 | } |
||
81 | set |
||
82 | { |
||
83 | _IsFitOn = value; |
||
84 | RaisePropertyChanged("IsFitOn"); |
||
85 | } |
||
86 | } |
||
87 | |||
88 | public void RaisePropertyChanged(string propName) |
||
89 | { |
||
90 | if (PropertyChanged != null) |
||
91 | PropertyChanged(this, new PropertyChangedEventArgs(propName)); |
||
92 | } |
||
93 | |||
94 | public void SetPageNavi(List<DOCPAGE> PageList, string DefaultUri) |
||
95 | { |
||
96 | 548c696e | ljiyeon | Logger.sendCheckLog("SetPageNavi", 1); |
97 | 787a4489 | KangIngu | this._PageList = PageList; |
98 | this._DefaultUri = DefaultUri; |
||
99 | ThumbnailSet(); |
||
100 | this.PageCount = PageList.Count(); |
||
101 | //ThumbNmailSet(); |
||
102 | rdoAllPages.Checked += new RoutedEventHandler(rdoCommented_Checked); |
||
103 | rdoFavoritePages.Checked += new RoutedEventHandler(rdoFavoritePages_Checked); |
||
104 | expCommentPages.PreviewCollapsed += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewCollapsed); |
||
105 | expCommentPages.PreviewExpanded += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewExpanded); |
||
106 | } |
||
107 | void rdoCommented_Checked(object sender, RoutedEventArgs e) |
||
108 | { |
||
109 | 548c696e | ljiyeon | Logger.sendCheckLog("rdoCommented_Checked", 1); |
110 | 787a4489 | KangIngu | if (rdoAllPages.IsChecked == true) expCommentPages.IsExpanded = false; |
111 | SetCommentPages(); |
||
112 | } |
||
113 | |||
114 | void rdoFavoritePages_Checked(object sender, RoutedEventArgs e) |
||
115 | { |
||
116 | 548c696e | ljiyeon | Logger.sendCheckLog("rdoFavoritePages_Checked", 1); |
117 | 992a98b4 | KangIngu | if (rdoFavoritePages.IsChecked == true) |
118 | expCommentPages.IsExpanded = false; |
||
119 | |||
120 | _FavoriteSet = _FavoriteSet == null ? new List<FAVORITE_DOC>() : _FavoriteSet; |
||
121 | if (_FavoriteSet.Count > 0) |
||
122 | { |
||
123 | SetCommentPages_Favorite(); //수정 |
||
124 | } |
||
125 | else |
||
126 | { |
||
127 | rdoAllPages.IsChecked = true; |
||
128 | rdoFavoritePages.IsChecked = false; |
||
129 | } |
||
130 | } |
||
131 | |||
132 | private void SetCommentPages_Favorite() |
||
133 | { |
||
134 | 548c696e | ljiyeon | Logger.sendCheckLog("SetCommentPages_Favorite", 1); |
135 | 992a98b4 | KangIngu | ThumbnailSet(); |
136 | //_UsersCommentPagesList |
||
137 | //var result = (from A in _UsersCommentPagesList |
||
138 | // from B in _FavoriteSet |
||
139 | // where A.PageNumber.Contains(B.PageNo) |
||
140 | // select A).ToList(); |
||
141 | //_UsersCommentPagesList = result; |
||
142 | |||
143 | SetCommentPages(); |
||
144 | |||
145 | 787a4489 | KangIngu | } |
146 | 992a98b4 | KangIngu | |
147 | 787a4489 | KangIngu | void expCommentPages_PreviewCollapsed(object sender, Telerik.Windows.RadRoutedEventArgs e) |
148 | { |
||
149 | //txtThumbCount.Visibility = Visibility.Collapsed; |
||
150 | } |
||
151 | |||
152 | void expCommentPages_PreviewExpanded(object sender, Telerik.Windows.RadRoutedEventArgs e) |
||
153 | { |
||
154 | 548c696e | ljiyeon | Logger.sendCheckLog("expCommentPages_PreviewExpanded", 1); |
155 | 787a4489 | KangIngu | rdoAllPages.IsChecked = false; |
156 | rdoFavoritePages.IsChecked = false; |
||
157 | //txtThumbCount.Visibility = Visibility.Visible; |
||
158 | SetCommentPages(); |
||
159 | } |
||
160 | |||
161 | private void ImgListbox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) |
||
162 | { |
||
163 | 548c696e | ljiyeon | Logger.sendCheckLog("ImgListbox_SelectionChanged", 1); |
164 | 787a4489 | KangIngu | if (ImgListbox.SelectedItem != null) |
165 | { |
||
166 | int _PageNo = -1; |
||
167 | |||
168 | if (this.CurrentPage != null) |
||
169 | { |
||
170 | _PageNo = this.CurrentPage.PageNumber; |
||
171 | }; |
||
172 | |||
173 | if (_PageNo != ((ImgListbox.SelectedItem as ThumbnailItem).PageNumber)) |
||
174 | { |
||
175 | 64f6713a | humkyung | var _page = this._thumbnailItems.Where(item => item.PageNumber == (ImgListbox.SelectedItem as ThumbnailItem).PageNumber); |
176 | if (_page.Count() > 0) |
||
177 | { |
||
178 | ThumbnailItem _item = _page.First(); |
||
179 | setPageChange(_item); |
||
180 | } |
||
181 | 787a4489 | KangIngu | } |
182 | } |
||
183 | } |
||
184 | |||
185 | public bool GotoPageFlag = false; |
||
186 | |||
187 | b2a6b24a | humkyung | /// <summary> |
188 | /// 해당 썸네일로 이동 |
||
189 | /// </summary> |
||
190 | /// <param name="_pageNumber"></param> |
||
191 | 787a4489 | KangIngu | public void GotoPage(int _pageNumber) |
192 | { |
||
193 | int _PageNo = -1; |
||
194 | if (int.TryParse(_pageNumber.ToString(), out _PageNo)) |
||
195 | { |
||
196 | var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo); |
||
197 | if (_page.Count() > 0) |
||
198 | { |
||
199 | ThumbnailItem _item = _page.First(); |
||
200 | setPageChange(_item); |
||
201 | 64f6713a | humkyung | this.ImgListbox.SelectedIndex = _pageNumber - 1; |
202 | this.ImgListbox.ScrollIntoView(_pageNumber - 1); |
||
203 | 787a4489 | KangIngu | } |
204 | } |
||
205 | d974f3f8 | ljiyeon | } |
206 | 787a4489 | KangIngu | |
207 | public void setPageChange(ThumbnailItem thumbnailItem) |
||
208 | { |
||
209 | 548c696e | ljiyeon | Logger.sendCheckLog("setPageChange", 1); |
210 | 787a4489 | KangIngu | if (thumbnailItem != null) |
211 | { |
||
212 | if (PageChanging != null) |
||
213 | { |
||
214 | //강인구 수정(페이지가 같을 경우 이동 안함) |
||
215 | if (CurrentPage != null && CurrentPage == thumbnailItem) |
||
216 | { |
||
217 | return; |
||
218 | } |
||
219 | 64f6713a | humkyung | |
220 | this.CurrentPage = _NextPage; |
||
221 | 787a4489 | KangIngu | _NextPage = thumbnailItem; |
222 | PageChanging(this, new PageChangeEventArgs |
||
223 | { |
||
224 | CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(), |
||
225 | PageNumber = Convert.ToInt32(thumbnailItem.PageNumber), |
||
226 | PageUri = null |
||
227 | }); |
||
228 | } |
||
229 | } |
||
230 | } |
||
231 | 64f6713a | humkyung | |
232 | d974f3f8 | ljiyeon | public void GotoPageTALK(int _pageNumber, int _angle) |
233 | { |
||
234 | int _PageNo = -1; |
||
235 | |||
236 | if (int.TryParse(_pageNumber.ToString(), out _PageNo)) |
||
237 | { |
||
238 | var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo); |
||
239 | if (_page.Count() > 0) |
||
240 | { |
||
241 | ThumbnailItem _item = _page.First(); |
||
242 | setPageChangeTALK(_item, _angle); |
||
243 | this.ImgListbox.SelectedIndex = _pageNumber - 1; |
||
244 | this.ImgListbox.ScrollIntoView(_pageNumber - 1); |
||
245 | } |
||
246 | } |
||
247 | } |
||
248 | |||
249 | public void setPageChangeTALK(ThumbnailItem thumbnailItem, int _angle) |
||
250 | { |
||
251 | if (thumbnailItem != null) |
||
252 | { |
||
253 | if (PageChanging != null) |
||
254 | { |
||
255 | this.CurrentPage = _NextPage; |
||
256 | _NextPage = thumbnailItem; |
||
257 | PageChanging(this, new PageChangeEventArgs |
||
258 | { |
||
259 | CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(), |
||
260 | PageNumber = Convert.ToInt32(thumbnailItem.PageNumber), |
||
261 | PageUri = null |
||
262 | }); |
||
263 | |||
264 | var instanceMain = this.ParentOfType<MainWindow>(); |
||
265 | |||
266 | var rotationNum = (_angle - instanceMain.dzMainMenu.rotate.Angle) / 90; |
||
267 | |||
268 | if (rotationNum > 0) // 1, 2, 3 |
||
269 | { |
||
270 | for(int i = 0; i < rotationNum; i++) |
||
271 | { |
||
272 | drawingPannelRotate(true); |
||
273 | } |
||
274 | } |
||
275 | else if(rotationNum < 0)// -1, -2, -3 |
||
276 | { |
||
277 | for (int i = 0; i < -rotationNum; i++) |
||
278 | { |
||
279 | drawingPannelRotate(false); |
||
280 | } |
||
281 | } |
||
282 | } |
||
283 | } |
||
284 | } |
||
285 | |||
286 | public void drawingPannelRotate(bool Flag) |
||
287 | { |
||
288 | var instanceMain = this.ParentOfType<MainWindow>(); |
||
289 | |||
290 | if (Flag) |
||
291 | { |
||
292 | if (instanceMain.dzMainMenu.rotate.Angle == 270) |
||
293 | { |
||
294 | instanceMain.dzMainMenu.rotate.Angle = 0; |
||
295 | } |
||
296 | else |
||
297 | { |
||
298 | instanceMain.dzMainMenu.rotate.Angle += 90; |
||
299 | } |
||
300 | } |
||
301 | else |
||
302 | { |
||
303 | if (instanceMain.dzMainMenu.rotate.Angle == 0) |
||
304 | { |
||
305 | instanceMain.dzMainMenu.rotate.Angle = 270; |
||
306 | } |
||
307 | else |
||
308 | { |
||
309 | instanceMain.dzMainMenu.rotate.Angle -= 90; |
||
310 | } |
||
311 | } |
||
312 | |||
313 | if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth) |
||
314 | { |
||
315 | double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
||
316 | instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
||
317 | instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize; |
||
318 | } |
||
319 | |||
320 | if (instanceMain.dzMainMenu.rotate.Angle == 0) |
||
321 | { |
||
322 | instanceMain.dzMainMenu.translate.X = 0; |
||
323 | instanceMain.dzMainMenu.translate.Y = 0; |
||
324 | } |
||
325 | else if (instanceMain.dzMainMenu.rotate.Angle == 90) |
||
326 | { |
||
327 | instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
||
328 | instanceMain.dzMainMenu.translate.Y = 0; |
||
329 | } |
||
330 | else if (instanceMain.dzMainMenu.rotate.Angle == 180) |
||
331 | { |
||
332 | instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
||
333 | instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
||
334 | } |
||
335 | else |
||
336 | { |
||
337 | instanceMain.dzMainMenu.translate.X = 0; |
||
338 | instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
||
339 | } |
||
340 | |||
341 | instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle; |
||
342 | ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width; |
||
343 | ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height; |
||
344 | ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X; |
||
345 | ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y; |
||
346 | ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle; |
||
347 | |||
348 | instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data => |
||
349 | { |
||
350 | data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString()); |
||
351 | |||
352 | instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems; |
||
353 | var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault(); |
||
354 | instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString()); |
||
355 | |||
356 | var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault(); |
||
357 | if (rotationdoc != null) |
||
358 | { |
||
359 | rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE; |
||
360 | } |
||
361 | else |
||
362 | { |
||
363 | ViewerDataModel.Instance.RotationDocs.Add(instance); |
||
364 | } |
||
365 | instanceMain.dzMainMenu.pageNavigator.setPageChange(data); |
||
366 | }); |
||
367 | } |
||
368 | |||
369 | 787a4489 | KangIngu | public void SetNextPage() |
370 | 548c696e | ljiyeon | { |
371 | Logger.sendCheckLog("pageNavigator_PageChanging_SetNextPage", 1); |
||
372 | 787a4489 | KangIngu | CurrentPage = _NextPage; |
373 | PageChange(_NextPage); |
||
374 | } |
||
375 | 64f6713a | humkyung | |
376 | 787a4489 | KangIngu | private void PageChange(ThumbnailItem thumbitem) |
377 | { |
||
378 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_PageChange", 1); |
379 | 787a4489 | KangIngu | if (PageChanged != null) |
380 | { |
||
381 | var uri = _DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString()); |
||
382 | //var _thumbitem = _thumbnailItems.Where(item => item.PageNumber == DocPage.PageNumber).First(); |
||
383 | var _itemIndex = _thumbnailItems.IndexOf(thumbitem); |
||
384 | //ImgListbox.SelectedItem(_thumbitem, true); |
||
385 | ImgListbox.SelectedItem = thumbitem; |
||
386 | |||
387 | if (_itemIndex < _thumbnailItems.Count() - 1) |
||
388 | ImgListbox.ScrollIntoView(_itemIndex); |
||
389 | else |
||
390 | ImgListbox.ScrollIntoView(_thumbnailItems.Count() - 1); |
||
391 | |||
392 | //txtCurentPageNo.Text = (_itemIndex + 1).ToString(); |
||
393 | |||
394 | //txtCurentPageNo.Text = this.CurrentPage.PageNumber.ToString(); |
||
395 | |||
396 | var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber); |
||
397 | |||
398 | if (_DocPages.Count() > 0) |
||
399 | { |
||
400 | var _page = _DocPages.First(); |
||
401 | |||
402 | PageChanged(this, new PageChangeEventArgs |
||
403 | { |
||
404 | CurrentPage = _page, |
||
405 | PageUri = uri, |
||
406 | PageNumber = thumbitem.PageNumber |
||
407 | }); |
||
408 | ImgListbox.SelectedItem = thumbitem; |
||
409 | |||
410 | } |
||
411 | else |
||
412 | { |
||
413 | 6c781c0c | djkim | //System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다"); |
414 | 787a4489 | KangIngu | } |
415 | } |
||
416 | } |
||
417 | |||
418 | void lstSelectComment_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) |
||
419 | { |
||
420 | SetCommentPages(); |
||
421 | } |
||
422 | |||
423 | |||
424 | void user_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
||
425 | { |
||
426 | SetCommentPages(); |
||
427 | 6c781c0c | djkim | //System.Diagnostics.Debug.WriteLine(e.PropertyName); |
428 | 787a4489 | KangIngu | } |
429 | public void SetCommentPages() |
||
430 | { |
||
431 | 548c696e | ljiyeon | Logger.sendCheckLog("SetCommentPages", 1); |
432 | 787a4489 | KangIngu | ThumbnailSet(); |
433 | SetCommentList(_UsersCommentPagesList.ToList()); |
||
434 | } |
||
435 | |||
436 | public void SetCommentList(List<UsersCommentPagesMember> UsersCommentPagesList) |
||
437 | { |
||
438 | 548c696e | ljiyeon | Logger.sendCheckLog("SetCommentList", 1); |
439 | 787a4489 | KangIngu | #region 기존 색상 제거 작업 |
440 | foreach (var item in this._thumbnailItems) |
||
441 | { |
||
442 | item.DisplayColorItems.Clear(); |
||
443 | } |
||
444 | #endregion |
||
445 | |||
446 | |||
447 | |||
448 | List<UsersCommentPagesMember> _delItem = new List<UsersCommentPagesMember>(); |
||
449 | |||
450 | _UsersCommentPagesList.ToList().ForEach(item => |
||
451 | { |
||
452 | var _comm = UsersCommentPagesList.Where(a => a.MarkupInfoID == item.MarkupInfoID); |
||
453 | |||
454 | if (_comm.Count() == 0) |
||
455 | { |
||
456 | _delItem.Add(item); |
||
457 | } |
||
458 | }); |
||
459 | |||
460 | _delItem.ForEach(f => _UsersCommentPagesList.Remove(f)); |
||
461 | |||
462 | UsersCommentPagesList.ForEach(user => |
||
463 | { |
||
464 | user.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged); |
||
465 | user.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged); |
||
466 | |||
467 | var _commLst = _UsersCommentPagesList.Where(o => o.MarkupInfoID == user.MarkupInfoID); |
||
468 | |||
469 | if (_commLst.Count() == 0) |
||
470 | { |
||
471 | _UsersCommentPagesList.Add(user); |
||
472 | } |
||
473 | else |
||
474 | { |
||
475 | if (_commLst.First().PageNumber != user.PageNumber) |
||
476 | _commLst.First().PageNumber = user.PageNumber; |
||
477 | } |
||
478 | |||
479 | user.PageNumber.ForEach(page => |
||
480 | { |
||
481 | var _items = this._thumbnailItems.Where(item => item.PageNumber == page); |
||
482 | |||
483 | if (_items.Count() > 0) |
||
484 | _items.First().DisplayColorItems.Add(new SetColorMarkupItem { DisplayColor = user.SetColor }); |
||
485 | }); |
||
486 | }); |
||
487 | |||
488 | |||
489 | |||
490 | var data = _UsersCommentPagesList.OrderByDescending(p => p.isConSolidation == Convert.ToInt32(true)).ToList(); |
||
491 | if (data.Count() != 0) |
||
492 | { |
||
493 | if (Convert.ToBoolean(data.First().isConSolidation)) |
||
494 | { |
||
495 | data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().UserName = "Consolidated"; |
||
496 | data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().Depart = ""; |
||
497 | this.lstSelectComment.ItemsSource = data; |
||
498 | } |
||
499 | else |
||
500 | { |
||
501 | this.lstSelectComment.ItemsSource = _UsersCommentPagesList; //섬네일 |
||
502 | } |
||
503 | } |
||
504 | else |
||
505 | { |
||
506 | this.lstSelectComment.ItemsSource = _UsersCommentPagesList; //섬네일 |
||
507 | } |
||
508 | //this.ImgListbox.ItemsSource = null; |
||
509 | this.ImgListbox.ItemsSource = this._thumbnailItems; |
||
510 | var template = this.ImgListbox.ItemTemplate; |
||
511 | this.ImgListbox.ItemTemplate = null; |
||
512 | this.ImgListbox.ItemTemplate = template; |
||
513 | this.ImgListbox.UpdateLayout(); |
||
514 | } |
||
515 | |||
516 | private void ThumbnailSet() |
||
517 | { |
||
518 | 548c696e | ljiyeon | Logger.sendCheckLog("ThumbnailSet", 1); |
519 | 787a4489 | KangIngu | if (!_Initialize) return; |
520 | |||
521 | this._thumbnailItems = new ObservableCollection<ThumbnailItem>(); |
||
522 | List<int> _selectComment = new List<int>(); |
||
523 | if (this.lstSelectComment.ItemsSource != null) |
||
524 | { |
||
525 | var _pages = from commentPage in this.lstSelectComment.ItemsSource.Cast<UsersCommentPagesMember>() |
||
526 | where commentPage.IsSelected == true |
||
527 | select commentPage.PageNumber; |
||
528 | |||
529 | foreach (var item in _pages) |
||
530 | { |
||
531 | item.ForEach(pp => _selectComment.Add(pp)); |
||
532 | } |
||
533 | |||
534 | _selectComment.Distinct(); |
||
535 | } |
||
536 | |||
537 | var uri = _DefaultUri.Replace("{0}/{1}_{2}", "8/0_0"); |
||
538 | this._PageList = this._PageList.OrderBy(data => data.PAGE_NUMBER).ToList(); |
||
539 | //this._PageList.ForEach(page => |
||
540 | ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page => |
||
541 | { |
||
542 | var _pageNo = page.PAGE_NUMBER; |
||
543 | bool _addFlag = false; |
||
544 | |||
545 | 276fdd9b | KangIngu | if (rdoFavoritePages.IsChecked == false) |
546 | 787a4489 | KangIngu | { |
547 | 276fdd9b | KangIngu | if (_selectComment.Count() > 0) |
548 | 787a4489 | KangIngu | { |
549 | 276fdd9b | KangIngu | if ((rdoAllPages.IsChecked == true) |
550 | || (expCommentPages.IsExpanded == true && _selectComment.Where(s => s == _pageNo).Count() > 0)) |
||
551 | { |
||
552 | _addFlag = true; |
||
553 | } |
||
554 | 787a4489 | KangIngu | } |
555 | 276fdd9b | KangIngu | else |
556 | { |
||
557 | //if (App.ViewInfo.IsCustomPage) |
||
558 | //{ |
||
559 | // //_addFlag = false; |
||
560 | |||
561 | // //App.ViewInfo.IsCustomPage = false; |
||
562 | // //this.rdoAllPages.Visibility = System.Windows.Visibility.Collapsed; |
||
563 | // //this.lstSelectComment.Visibility = System.Windows.Visibility.Collapsed; |
||
564 | // this.rdoAllPages.IsChecked = false; |
||
565 | // this.rdoFavoritePages.IsChecked = true; |
||
566 | // //SetCommentPages(); |
||
567 | //} |
||
568 | //else |
||
569 | //{ |
||
570 | 787a4489 | KangIngu | _addFlag = true; |
571 | 276fdd9b | KangIngu | //} |
572 | } |
||
573 | 787a4489 | KangIngu | } |
574 | |||
575 | |||
576 | if(_addFlag) |
||
577 | { |
||
578 | this._thumbnailItems.Add(new ThumbnailItem |
||
579 | { |
||
580 | ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
||
581 | PageNumber = _pageNo, |
||
582 | Angle = page.PAGE_ANGLE, |
||
583 | }); |
||
584 | } |
||
585 | else |
||
586 | { |
||
587 | 992a98b4 | KangIngu | if ((rdoFavoritePages.IsChecked == true) && _FavoriteSet.Where(data => data.PAGE_NO == _pageNo).FirstOrDefault() != null) |
588 | { |
||
589 | this._thumbnailItems.Add(new ThumbnailItem |
||
590 | { |
||
591 | ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
||
592 | PageNumber = _pageNo, |
||
593 | Angle = page.PAGE_ANGLE, |
||
594 | }); |
||
595 | } |
||
596 | 787a4489 | KangIngu | } |
597 | |||
598 | |||
599 | |||
600 | //this._thumbnailItems.Add(new ThumbnailItem |
||
601 | //{ |
||
602 | // ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())), |
||
603 | |||
604 | // //ImageUri = new Uri(@"http://www.honeyhead.net/Pages/000000/111111/11111111/1.cmp"), |
||
605 | |||
606 | // //ImageUri = new Uri(@"https://image.freepik.com/free-vector/abstract-logo-in-flame-shape_1043-44.jpg"), |
||
607 | // //DisplayColorItems = pageColor, |
||
608 | // PageNumber = Convert.ToInt32(_pageNo), |
||
609 | // Angle = Convert.ToInt32(page.PAGE_ANGLE), |
||
610 | //}); |
||
611 | }); |
||
612 | |||
613 | //txtTotPageNo.Text = this._PageList.Count().ToString(); |
||
614 | |||
615 | //txtThumbCount.Text = String.Format("Count : {0}", (this._thumbnailItems.Count).ToString()); |
||
616 | |||
617 | if (ImgListbox.ItemsSource == null) |
||
618 | { |
||
619 | ImgListbox.ItemsSource = this._thumbnailItems; |
||
620 | |||
621 | this._thumbnailItems.ToList().ForEach(data => |
||
622 | { |
||
623 | data.Width = ImgListbox.ActualWidth; |
||
624 | }); |
||
625 | |||
626 | if (ImgListbox.Items.Count > 0) |
||
627 | { |
||
628 | //int StartPageIdx = Convert.ToInt32(App.ViewInfo.StartPage) - 1; |
||
629 | int StartPageIdx = 1; |
||
630 | //if (App.ViewInfo.IsCustomPage) |
||
631 | //{ |
||
632 | // ImgListbox.SelectedItem = ImgListbox.Items.Where(data => (data as ThumbnailItem).PageNumber == Convert.ToInt32(App.ViewInfo.StartPage)).FirstOrDefault(); |
||
633 | //} |
||
634 | //else |
||
635 | //{ |
||
636 | |||
637 | if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1) |
||
638 | { |
||
639 | ImgListbox.SelectedItem = ImgListbox.Items[0]; |
||
640 | } |
||
641 | else |
||
642 | { |
||
643 | ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx]; |
||
644 | } |
||
645 | //} |
||
646 | } |
||
647 | } |
||
648 | else |
||
649 | { |
||
650 | ImgListbox.UpdateLayout(); |
||
651 | ImgListbox.ItemsSource = this._thumbnailItems; |
||
652 | } |
||
653 | } |
||
654 | |||
655 | private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
||
656 | { |
||
657 | if (e.ClickCount >= 2) |
||
658 | { |
||
659 | var selectItem = gogogo.SelectedItem as IKCOM.MarkupItem; |
||
660 | GotoPage(selectItem.PageNumber); |
||
661 | MarkupToPDF.Controls.Parsing.LayerControl control = new MarkupToPDF.Controls.Parsing.LayerControl(); |
||
662 | var result = control.markupParse_GetBaseControl(selectItem.Data); |
||
663 | Rect rect = new Rect(new Point(result.StartPoint.X-100, result.StartPoint.Y-100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100)); |
||
664 | this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
||
665 | //bool isGO = false; |
||
666 | |||
667 | //var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer; |
||
668 | //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit; |
||
669 | //imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle; |
||
670 | //imageViewer.InteractiveUserRectangle += (sen, ea) => |
||
671 | //{ |
||
672 | // System.Diagnostics.Debug.WriteLine(ea.Bounds); |
||
673 | // if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End) |
||
674 | // { |
||
675 | // this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds); |
||
676 | // } |
||
677 | |||
678 | //}; |
||
679 | //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal; |
||
680 | |||
681 | //GotoPage(gogogo.SelectedItem as MarkupList) |
||
682 | } |
||
683 | } |
||
684 | |||
685 | private void commentUser_SelectionChanged(object sender, SelectionChangedEventArgs e) |
||
686 | { |
||
687 | 79f3f21a | djkim | tbSearch.Text = string.Empty; |
688 | 787a4489 | KangIngu | if (e.AddedItems.Count > 0) |
689 | { |
||
690 | if (commentUser.Items.Count > 0) |
||
691 | { |
||
692 | MarkupInfoSmallList.Clear(); |
||
693 | //var d = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList.First(); |
||
694 | //d.PageNumber |
||
695 | |||
696 | //e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList.First(). |
||
697 | //gogo.DataContext = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList; |
||
698 | |||
699 | //gogogo.ItemsSource = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList; |
||
700 | //gogogo.ItemsSource = ViewerDataModel.Instance._markupInfoList.Where(d=>d.UserName == sender as RadCombo |
||
701 | |||
702 | var temp = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault(); |
||
703 | 4836261b | djkim | var markuplist = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.MarkupInfoID == temp.MarkupInfoID).ToList(); |
704 | markuplist.ForEach(d => |
||
705 | 787a4489 | KangIngu | { |
706 | MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
||
707 | { |
||
708 | Data = d.Data, |
||
709 | Data_Type = d.Data_Type, |
||
710 | PageNumber = d.PageNumber, |
||
711 | UserID = temp.UserID, |
||
712 | UserName = temp.UserName, |
||
713 | }); |
||
714 | }); |
||
715 | gogogo.ItemsSource = null; |
||
716 | gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
||
717 | 4836261b | djkim | |
718 | 787a4489 | KangIngu | } |
719 | } |
||
720 | else |
||
721 | { |
||
722 | MarkupInfoSmallList.Clear(); |
||
723 | ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
||
724 | { |
||
725 | 4836261b | djkim | var markuplist = ViewerDataModel.Instance.MarkupList_USER.Where(u => u.MarkupInfoID == d.MarkupInfoID).ToList(); |
726 | |||
727 | markuplist.ForEach(b => |
||
728 | 787a4489 | KangIngu | { |
729 | MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
||
730 | { |
||
731 | |||
732 | Data = b.Data, |
||
733 | Data_Type = b.Data_Type, |
||
734 | PageNumber = b.PageNumber, |
||
735 | UserID = d.UserID, |
||
736 | UserName = d.UserName, |
||
737 | }); |
||
738 | }); |
||
739 | 4836261b | djkim | |
740 | 787a4489 | KangIngu | }); |
741 | gogogo.ItemsSource = null; |
||
742 | gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
||
743 | } |
||
744 | } |
||
745 | |||
746 | public class MarkupInfoItemSmall |
||
747 | { |
||
748 | public string Id { get; set; } |
||
749 | public string UserName { get; set; } |
||
750 | public string UserID { get; set; } |
||
751 | public int PageNumber { get; set; } |
||
752 | public string Data { get; set; } |
||
753 | public int Data_Type { get; set; } |
||
754 | } |
||
755 | |||
756 | private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; } |
||
757 | public List<MarkupInfoItemSmall> MarkupInfoSmallList |
||
758 | { |
||
759 | get |
||
760 | { |
||
761 | if (_MarkupInfoSmallList == null) |
||
762 | { |
||
763 | _MarkupInfoSmallList = new List<MarkupInfoItemSmall>(); |
||
764 | } |
||
765 | return _MarkupInfoSmallList; |
||
766 | } |
||
767 | set |
||
768 | { |
||
769 | |||
770 | _MarkupInfoSmallList = value; |
||
771 | RaisePropertyChanged("MarkupInfoSmallList"); |
||
772 | } |
||
773 | } |
||
774 | |||
775 | 2aaf9645 | humkyung | /// <summary> |
776 | /// goto page and select item selected by user |
||
777 | /// </summary> |
||
778 | /// <param name="sender"></param> |
||
779 | /// <param name="e"></param> |
||
780 | 787a4489 | KangIngu | private void RadButton_Click(object sender, RoutedEventArgs e) |
781 | { |
||
782 | var clickButtonItem = sender as RadButton; |
||
783 | if (clickButtonItem != null && clickButtonItem.CommandParameter != null) |
||
784 | { |
||
785 | try |
||
786 | { |
||
787 | Rect rect = new Rect(); |
||
788 | Point s_point = new Point(); |
||
789 | Point e_point = new Point(); |
||
790 | |||
791 | MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall; |
||
792 | GotoPage(Convert.ToInt32(gaza.PageNumber)); |
||
793 | 2aaf9645 | humkyung | |
794 | 787a4489 | KangIngu | var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(gaza.Data.ToString()); //언패킹작업 |
795 | switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString())) |
||
796 | { |
||
797 | case MarkupToPDF.Controls.Common.ControlType.TextControl: |
||
798 | { |
||
799 | MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
||
800 | 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)); |
||
801 | } |
||
802 | break; |
||
803 | case MarkupToPDF.Controls.Common.ControlType.TextBorder: |
||
804 | { |
||
805 | MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
||
806 | 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)); |
||
807 | } |
||
808 | break; |
||
809 | case MarkupToPDF.Controls.Common.ControlType.TextCloud: |
||
810 | { |
||
811 | MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
||
812 | 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)); |
||
813 | } |
||
814 | break; |
||
815 | case MarkupToPDF.Controls.Common.ControlType.PolygonControl: |
||
816 | { |
||
817 | MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
||
818 | |||
819 | foreach (Point A in instance.PointSet) |
||
820 | { |
||
821 | if (s_point == new Point()) |
||
822 | { |
||
823 | s_point = A; |
||
824 | e_point = A; |
||
825 | } |
||
826 | s_point.X = Math.Min(s_point.X, A.X); |
||
827 | s_point.Y = Math.Min(s_point.Y, A.Y); |
||
828 | e_point.X = Math.Max(e_point.X, A.X); |
||
829 | e_point.Y = Math.Max(e_point.Y, A.Y); |
||
830 | } |
||
831 | rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
||
832 | } |
||
833 | break; |
||
834 | case MarkupToPDF.Controls.Common.ControlType.PolygonCloud: |
||
835 | { |
||
836 | MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
||
837 | |||
838 | foreach (Point A in instance.PointSet) |
||
839 | { |
||
840 | if (s_point == new Point()) |
||
841 | { |
||
842 | s_point = A; |
||
843 | e_point = A; |
||
844 | } |
||
845 | s_point.X = Math.Min(s_point.X, A.X); |
||
846 | s_point.Y = Math.Min(s_point.Y, A.Y); |
||
847 | e_point.X = Math.Max(e_point.X, A.X); |
||
848 | e_point.Y = Math.Max(e_point.Y, A.Y); |
||
849 | } |
||
850 | rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
||
851 | } |
||
852 | break; |
||
853 | case MarkupToPDF.Controls.Common.ControlType.ChainLine: |
||
854 | { |
||
855 | MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
||
856 | |||
857 | foreach (Point A in instance.PointSet) |
||
858 | { |
||
859 | if (s_point == new Point()) |
||
860 | { |
||
861 | s_point = A; |
||
862 | e_point = A; |
||
863 | } |
||
864 | s_point.X = Math.Min(s_point.X, A.X); |
||
865 | s_point.Y = Math.Min(s_point.Y, A.Y); |
||
866 | e_point.X = Math.Max(e_point.X, A.X); |
||
867 | e_point.Y = Math.Max(e_point.Y, A.Y); |
||
868 | } |
||
869 | rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
||
870 | } |
||
871 | break; |
||
872 | case MarkupToPDF.Controls.Common.ControlType.Ink: |
||
873 | { |
||
874 | MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
||
875 | |||
876 | foreach (Point A in instance.PointSet) |
||
877 | { |
||
878 | if (s_point == new Point()) |
||
879 | { |
||
880 | s_point = A; |
||
881 | e_point = A; |
||
882 | } |
||
883 | s_point.X = Math.Min(s_point.X, A.X); |
||
884 | s_point.Y = Math.Min(s_point.Y, A.Y); |
||
885 | e_point.X = Math.Max(e_point.X, A.X); |
||
886 | e_point.Y = Math.Max(e_point.Y, A.Y); |
||
887 | } |
||
888 | rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100)); |
||
889 | } |
||
890 | break; |
||
891 | default: |
||
892 | MarkupToPDF.Serialize.S_Control.S_BaseControl item = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data); |
||
893 | rect = new Rect(new Point(item.StartPoint.X - 100, item.StartPoint.Y - 100), new Point(item.EndPoint.X + 100, item.EndPoint.Y + 100)); |
||
894 | break; |
||
895 | } |
||
896 | |||
897 | 2aaf9645 | humkyung | this.ParentOfType<KCOM.Views.MainMenu>().SelecteItemByRect(rect); |
898 | 787a4489 | KangIngu | this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
899 | } |
||
900 | catch (Exception ex) |
||
901 | { |
||
902 | 2aaf9645 | humkyung | this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error"); |
903 | 787a4489 | KangIngu | } |
904 | } |
||
905 | } |
||
906 | 4836261b | djkim | public void MarkupListReload() |
907 | { |
||
908 | ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
||
909 | { |
||
910 | if (d.MarkupList != null) |
||
911 | { |
||
912 | d.MarkupList.ForEach(b => |
||
913 | { |
||
914 | MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
||
915 | { |
||
916 | Id = b.ID, |
||
917 | Data = b.Data, |
||
918 | Data_Type = b.Data_Type, |
||
919 | PageNumber = b.PageNumber, |
||
920 | UserID = d.UserID, |
||
921 | UserName = d.UserName, |
||
922 | }); |
||
923 | }); |
||
924 | } |
||
925 | }); |
||
926 | gogogo.ItemsSource = null; |
||
927 | gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
||
928 | 787a4489 | KangIngu | |
929 | 4836261b | djkim | commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList(); |
930 | commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
||
931 | } |
||
932 | 787a4489 | KangIngu | private void gogogo_Loaded(object sender, RoutedEventArgs e) |
933 | { |
||
934 | if (MarkupInfoSmallList.Count == 0) |
||
935 | { |
||
936 | ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d => |
||
937 | { |
||
938 | if (d.MarkupList != null) |
||
939 | { |
||
940 | d.MarkupList.ForEach(b => |
||
941 | { |
||
942 | MarkupInfoSmallList.Add(new MarkupInfoItemSmall |
||
943 | { |
||
944 | Id = b.ID, |
||
945 | Data = b.Data, |
||
946 | Data_Type = b.Data_Type, |
||
947 | PageNumber = b.PageNumber, |
||
948 | UserID = d.UserID, |
||
949 | UserName = d.UserName, |
||
950 | }); |
||
951 | }); |
||
952 | } |
||
953 | }); |
||
954 | gogogo.ItemsSource = null; |
||
955 | 4836261b | djkim | gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
956 | 787a4489 | KangIngu | |
957 | commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d=>d).ToList(); |
||
958 | commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList(); |
||
959 | } |
||
960 | } |
||
961 | |||
962 | private void commentType_SelectionChanged(object sender, SelectionChangedEventArgs e) |
||
963 | { |
||
964 | gogogo.ItemsSource = null; |
||
965 | 79f3f21a | djkim | tbSearch.Text = string.Empty; |
966 | 787a4489 | KangIngu | if (e.AddedItems.Count >0) |
967 | { |
||
968 | |||
969 | gogogo.ItemsSource = MarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(e.AddedItems[0])).ToList(); |
||
970 | } |
||
971 | else |
||
972 | { |
||
973 | gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
||
974 | } |
||
975 | } |
||
976 | |||
977 | private void commentPage_SelectionChanged(object sender, SelectionChangedEventArgs e) |
||
978 | { |
||
979 | gogogo.ItemsSource = null; |
||
980 | 79f3f21a | djkim | tbSearch.Text = string.Empty; |
981 | 787a4489 | KangIngu | if (e.AddedItems.Count > 0) |
982 | { |
||
983 | gogogo.ItemsSource = MarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(e.AddedItems[0])).ToList(); |
||
984 | } |
||
985 | else |
||
986 | { |
||
987 | gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); |
||
988 | } |
||
989 | } |
||
990 | |||
991 | private void btnPanorama_Click(object sender, RoutedEventArgs e) |
||
992 | { |
||
993 | ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow(); |
||
994 | } |
||
995 | 79f3f21a | djkim | |
996 | private void btnSearch_Click(object sender, RoutedEventArgs e) |
||
997 | { |
||
998 | string search_str = tbSearch.Text; |
||
999 | var sel_type = commentType.SelectedItem; |
||
1000 | var sel_user = commentUser.SelectedItem; |
||
1001 | var sel_page = commentPage.SelectedItem; |
||
1002 | List<MarkupInfoItemSmall> small_list = new List<MarkupInfoItemSmall>(); |
||
1003 | List<MarkupInfoItemSmall> list = MarkupInfoSmallList; |
||
1004 | if(sel_page !=null) |
||
1005 | { |
||
1006 | list = list.Where(d => d.PageNumber == Convert.ToInt32(sel_page)).ToList(); |
||
1007 | } |
||
1008 | if(sel_type !=null) |
||
1009 | { |
||
1010 | list = list.Where(d => d.Data_Type == Convert.ToInt32(sel_type)).ToList(); |
||
1011 | } |
||
1012 | if (sel_user != null) |
||
1013 | { |
||
1014 | list = list.Where(d => d.UserID == (sel_user as MarkupInfoItem).UserID).ToList(); |
||
1015 | } |
||
1016 | foreach (var item in list) |
||
1017 | { |
||
1018 | var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(item.Data.ToString()); |
||
1019 | |||
1020 | switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), item.Data_Type.ToString())) |
||
1021 | { |
||
1022 | case MarkupToPDF.Controls.Common.ControlType.TextControl: |
||
1023 | case MarkupToPDF.Controls.Common.ControlType.TextBorder: |
||
1024 | case MarkupToPDF.Controls.Common.ControlType.TextCloud: |
||
1025 | { |
||
1026 | MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data); |
||
1027 | if (instance.Text.Contains(search_str)) |
||
1028 | { |
||
1029 | small_list.Add(item); |
||
1030 | } |
||
1031 | } |
||
1032 | break; |
||
1033 | case MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl: |
||
1034 | case MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl: |
||
1035 | case MarkupToPDF.Controls.Common.ControlType.ArrowTextControl: |
||
1036 | case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl: |
||
1037 | case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl: |
||
1038 | case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl: |
||
1039 | { |
||
1040 | MarkupToPDF.Serialize.S_Control.S_ArrowTextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_ArrowTextControl>(data); |
||
1041 | if (instance.ArrowText.Contains(search_str)) |
||
1042 | { |
||
1043 | small_list.Add(item); |
||
1044 | } |
||
1045 | } |
||
1046 | break; |
||
1047 | |||
1048 | } |
||
1049 | |||
1050 | } |
||
1051 | |||
1052 | gogogo.ItemsSource = null; |
||
1053 | gogogo.ItemsSource = small_list.OrderBy(d => d.PageNumber).ToList(); |
||
1054 | tbSearch.Text = string.Empty; |
||
1055 | } |
||
1056 | 4836261b | djkim | |
1057 | 787a4489 | KangIngu | } |
1058 | } |