개정판 3908a575
issue #926: fixed page change logic
Change-Id: If039ebecb0b06e996ca13be190f7aeb82e85ece4
KCOM/Controls/Sample.xaml.cs | ||
---|---|---|
47 | 47 |
} |
48 | 48 |
} |
49 | 49 |
|
50 |
//private void ImgListbox_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
|
51 |
//{ |
|
52 |
|
|
53 |
// if (ImgListbox.SelectedItem !=null && (ImgListbox.SelectedItem as ThumbnailItem).PageNumber == CurrentPage.PageNumber) |
|
54 |
// { |
|
55 |
// this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ScaleToFit(); |
|
56 |
// } |
|
57 |
//} |
|
58 |
|
|
59 | 50 |
public ObservableCollection<ThumbnailItem> _thumbnailItems; |
60 | 51 |
private List<DOCPAGE> _PageList = null; |
61 | 52 |
private string _DefaultUri = null; |
62 | 53 |
public ThumbnailItem CurrentPage = null; |
63 |
public ThumbnailItem _NextPage = null; |
|
54 |
///public ThumbnailItem _NextPage = null;
|
|
64 | 55 |
public int PageCount = 0; |
65 | 56 |
|
66 | 57 |
private bool _Initialize; |
... | ... | |
156 | 147 |
{ |
157 | 148 |
if (ImgListbox.SelectedItem != null) |
158 | 149 |
{ |
159 |
int _PageNo = -1; |
|
150 |
int _CurrentPageNo = -1; |
|
151 |
if (this.CurrentPage != null) _CurrentPageNo = this.CurrentPage.PageNumber; |
|
160 | 152 |
|
161 |
if (this.CurrentPage != null) |
|
153 |
int iPageNo = ((ImgListbox.SelectedItem as ThumbnailItem).PageNumber); |
|
154 |
if(_CurrentPageNo != iPageNo) |
|
162 | 155 |
{ |
163 |
_PageNo = this.CurrentPage.PageNumber; |
|
164 |
}; |
|
165 |
|
|
166 |
int nextpage = ((ImgListbox.SelectedItem as ThumbnailItem).PageNumber); |
|
167 |
if(_PageNo != nextpage) |
|
168 |
{ |
|
169 |
GotoPage(nextpage); |
|
156 |
///this.CurrentPage = this._NextPage; |
|
157 |
///this._NextPage = thumbnailItem; |
|
158 |
PageChanging(this, new PageChangeEventArgs |
|
159 |
{ |
|
160 |
CurrentPage = this._PageList.Where(p => p.PAGE_NUMBER == iPageNo).First(), |
|
161 |
PageNumber = iPageNo, |
|
162 |
PageUri = null |
|
163 |
}); |
|
170 | 164 |
} |
171 |
|
|
172 | 165 |
} |
166 |
|
|
173 | 167 |
var border = VisualTreeHelper.GetChild(ImgListbox, 0); |
174 | 168 |
if(border!= null) |
175 | 169 |
{ |
176 | 170 |
IEnumerable<ScrollViewer> scrollViewer = border.ChildrenOfType<ScrollViewer>(); |
177 | 171 |
|
178 | 172 |
} |
179 |
//ScrollViewer scrollViewer = (sender as RadListBox) as ScrollViewer; |
|
180 |
//ImgListbox.ScrollIntoView(ImgListbox.SelectedItem); |
|
181 | 173 |
} |
182 | 174 |
|
183 | 175 |
public bool GotoPageFlag = false; |
... | ... | |
185 | 177 |
/// <summary> |
186 | 178 |
/// 해당 썸네일로 이동 |
187 | 179 |
/// </summary> |
188 |
/// <param name="_pageNumber"></param> |
|
180 |
/// <param name="_pageNumber">이동할 페이지 번호</param>
|
|
189 | 181 |
public void GotoPage(int _pageNumber) |
190 | 182 |
{ |
191 | 183 |
try |
192 | 184 |
{ |
193 |
int _PageNo = -1;
|
|
194 |
if (int.TryParse(_pageNumber.ToString(), out _PageNo))
|
|
185 |
var _page = _thumbnailItems.Where(item => item.PageNumber == _pageNumber);
|
|
186 |
if (_page.Count() > 0)
|
|
195 | 187 |
{ |
196 |
var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo);
|
|
197 |
if (_page.Count() > 0)
|
|
188 |
ThumbnailItem thumbnailitem = _page.First();
|
|
189 |
if (PageChanging != null)
|
|
198 | 190 |
{ |
199 |
ThumbnailItem _item = _page.First(); |
|
200 |
setPageChange(_item); |
|
201 |
//this.ImgListbox.SelectedIndex = _pageNumber - 1; |
|
202 |
//this.ImgListbox.ScrollIntoView(_item); |
|
191 |
var _itemIndex = this._thumbnailItems.IndexOf(thumbnailitem); |
|
192 |
ImgListbox.SelectedItem = thumbnailitem; |
|
193 |
|
|
194 |
if (_itemIndex < _thumbnailItems.Count() - 1) |
|
195 |
ImgListbox.ScrollIntoView(_itemIndex); |
|
196 |
else |
|
197 |
ImgListbox.ScrollIntoView(this._thumbnailItems.Count() - 1); |
|
203 | 198 |
} |
204 | 199 |
} |
205 | 200 |
} |
... | ... | |
207 | 202 |
{ |
208 | 203 |
Logger.sendResLog("GotoPage", ex.Message, 0); |
209 | 204 |
} |
210 |
|
|
211 | 205 |
} |
212 | 206 |
|
213 |
public void setPageChange(ThumbnailItem thumbnailItem) |
|
207 |
/// <summary> |
|
208 |
/// 주어진 페이지로 변경한다 |
|
209 |
/// </summary> |
|
210 |
/// <param name="iPageNo">변경할 페이지 번호</param> |
|
211 |
public void ChangePage(int iPageNo) |
|
214 | 212 |
{ |
215 |
Logger.sendCheckLog("setPageChange", 1);
|
|
216 |
if (thumbnailItem != null)
|
|
213 |
var thumbitem = this._thumbnailItems.Where(item => item.PageNumber == iPageNo).FirstOrDefault();
|
|
214 |
if ((PageChanged != null) && (thumbitem != null))
|
|
217 | 215 |
{ |
218 |
if (PageChanging != null)
|
|
219 |
{
|
|
220 |
//if(CurrentPage != null && CurrentPage.PageNumber == _NextPage.PageNumber) |
|
221 |
//{
|
|
222 |
// return;
|
|
223 |
//}
|
|
224 |
this.CurrentPage = _NextPage;
|
|
225 |
_NextPage = thumbnailItem; |
|
226 |
PageChanging(this, new PageChangeEventArgs
|
|
216 |
var uri = _DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString());
|
|
217 |
//var _thumbitem = _thumbnailItems.Where(item => item.PageNumber == DocPage.PageNumber).First();
|
|
218 |
|
|
219 |
var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber);
|
|
220 |
if (_DocPages.Count() > 0)
|
|
221 |
{
|
|
222 |
var _page = _DocPages.First();
|
|
223 |
|
|
224 |
PageChanged(this, new PageChangeEventArgs
|
|
227 | 225 |
{ |
228 |
CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(),
|
|
229 |
PageNumber = Convert.ToInt32(thumbnailItem.PageNumber),
|
|
230 |
PageUri = null
|
|
226 |
CurrentPage = _page,
|
|
227 |
PageUri = uri,
|
|
228 |
PageNumber = thumbitem.PageNumber
|
|
231 | 229 |
}); |
230 |
ImgListbox.SelectedItem = thumbitem; |
|
231 |
|
|
232 |
} |
|
233 |
else |
|
234 |
{ |
|
235 |
//System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다"); |
|
232 | 236 |
} |
233 | 237 |
} |
234 | 238 |
} |
... | ... | |
256 | 260 |
{ |
257 | 261 |
if (PageChanging != null) |
258 | 262 |
{ |
259 |
this.CurrentPage = _NextPage; |
|
260 |
_NextPage = thumbnailItem; |
|
263 |
///this.CurrentPage = _NextPage;
|
|
264 |
///_NextPage = thumbnailItem;
|
|
261 | 265 |
PageChanging(this, new PageChangeEventArgs |
262 | 266 |
{ |
263 | 267 |
CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(), |
... | ... | |
366 | 370 |
{ |
367 | 371 |
ViewerDataModel.Instance.RotationDocs.Add(instance); |
368 | 372 |
} |
369 |
instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
|
|
373 |
instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
|
|
370 | 374 |
}); |
371 | 375 |
} |
372 | 376 |
|
373 |
public void SetNextPage() |
|
374 |
{ |
|
375 |
CurrentPage = _NextPage; |
|
376 |
PageChange(_NextPage); |
|
377 |
} |
|
378 |
|
|
379 |
private void PageChange(ThumbnailItem thumbitem) |
|
380 |
{ |
|
381 |
if (PageChanged != null) |
|
382 |
{ |
|
383 |
var uri = _DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString()); |
|
384 |
//var _thumbitem = _thumbnailItems.Where(item => item.PageNumber == DocPage.PageNumber).First(); |
|
385 |
var _itemIndex = _thumbnailItems.IndexOf(thumbitem); |
|
386 |
//ImgListbox.SelectedItem(_thumbitem, true); |
|
387 |
ImgListbox.SelectedItem = thumbitem; |
|
388 |
|
|
389 |
if (_itemIndex < _thumbnailItems.Count() - 1) |
|
390 |
ImgListbox.ScrollIntoView(_itemIndex); |
|
391 |
else |
|
392 |
ImgListbox.ScrollIntoView(_thumbnailItems.Count() - 1); |
|
393 |
|
|
394 |
var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber); |
|
395 |
|
|
396 |
if (_DocPages.Count() > 0) |
|
397 |
{ |
|
398 |
var _page = _DocPages.First(); |
|
399 |
|
|
400 |
PageChanged(this, new PageChangeEventArgs |
|
401 |
{ |
|
402 |
CurrentPage = _page, |
|
403 |
PageUri = uri, |
|
404 |
PageNumber = thumbitem.PageNumber |
|
405 |
}); |
|
406 |
ImgListbox.SelectedItem = thumbitem; |
|
407 |
|
|
408 |
} |
|
409 |
else |
|
410 |
{ |
|
411 |
//System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다"); |
|
412 |
} |
|
413 |
} |
|
414 |
} |
|
415 |
|
|
416 | 377 |
void lstSelectComment_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) |
417 | 378 |
{ |
418 | 379 |
SetCommentPages(); |
내보내기 Unified diff