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