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