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