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