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