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