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