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