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