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