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