개정판 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(); |
KCOM/Events/Implementation/TopMenuEvent.cs | ||
---|---|---|
1224 | 1224 |
{ |
1225 | 1225 |
try |
1226 | 1226 |
{ |
1227 |
|
|
1228 | 1227 |
var instanceMain = this.ParentOfType<MainWindow>(); |
1229 | 1228 |
var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber); |
1230 | 1229 |
if (string.IsNullOrEmpty(tlcurrentPage.Text)) |
... | ... | |
1295 | 1294 |
} |
1296 | 1295 |
} |
1297 | 1296 |
|
1298 |
|
|
1297 |
/// <summary> |
|
1298 |
/// 입력한 페이지로 이동한다 |
|
1299 |
/// </summary> |
|
1300 |
/// <param name="sender"></param> |
|
1301 |
/// <param name="e"></param> |
|
1299 | 1302 |
private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e) |
1300 | 1303 |
{ |
1301 |
//강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch |
|
1302 | 1304 |
if (e.Key == Key.Enter) |
1303 | 1305 |
{ |
1304 | 1306 |
try |
... | ... | |
1316 | 1318 |
Content = "페이지 번호를 정확하게 입력해 주세요", |
1317 | 1319 |
}); |
1318 | 1320 |
} |
1319 |
|
|
1320 | 1321 |
} |
1321 | 1322 |
} |
1322 | 1323 |
|
1323 |
|
|
1324 |
//public event EventHandler<WindowClosedEventArgs> Closed; |
|
1325 |
|
|
1326 |
//private void CheckEvent(object sender, RoutedEventArgs e) |
|
1327 |
//{ |
|
1328 |
// RadWindow CheckPop = new RadWindow(); |
|
1329 |
// test check = new test(); |
|
1330 |
|
|
1331 |
// CheckPop = new RadWindow |
|
1332 |
// { |
|
1333 |
// Width = 1700, |
|
1334 |
// Height = 510, |
|
1335 |
// Header = "My Check List", |
|
1336 |
// Content = check, |
|
1337 |
// Owner = this, |
|
1338 |
// ResizeMode = System.Windows.ResizeMode.NoResize, |
|
1339 |
// WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen, |
|
1340 |
// }; |
|
1341 |
// StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme()); |
|
1342 |
|
|
1343 |
// CheckPop.Closed += CheckPop_Closed; |
|
1344 |
// CheckPop.ShowDialog(); |
|
1345 |
//} |
|
1346 |
|
|
1347 | 1324 |
private void PanoramaEvent(object sender, RoutedEventArgs e) |
1348 | 1325 |
{ |
1349 | 1326 |
PanoramaShow(); |
... | ... | |
1658 | 1635 |
var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault(); |
1659 | 1636 |
instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString()); |
1660 | 1637 |
|
1661 |
instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
|
|
1638 |
instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
|
|
1662 | 1639 |
|
1663 | 1640 |
//rotation page add or update |
1664 | 1641 |
var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault(); |
KCOM/Views/MainMenu.xaml.cs | ||
---|---|---|
611 | 611 |
ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth; |
612 | 612 |
ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight; |
613 | 613 |
mainPanel.UpdateLayout(); |
614 |
this.pageNavigator.SetNextPage();
|
|
614 |
this.pageNavigator.ChangePage(ViewerDataModel.Instance.PageNumber);
|
|
615 | 615 |
|
616 | 616 |
//image dispose |
617 | 617 |
defaultBitmapImage = null; |
... | ... | |
2150 | 2150 |
{ |
2151 | 2151 |
if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount) |
2152 | 2152 |
{ |
2153 |
this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber + 1);
|
|
2153 |
this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1);
|
|
2154 | 2154 |
} |
2155 | 2155 |
|
2156 |
this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber); |
|
2156 |
//this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
|
|
2157 | 2157 |
|
2158 | 2158 |
} |
2159 | 2159 |
else if (e.XButton2 == MouseButtonState.Pressed) |
내보내기 Unified diff