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