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