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