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