示例#1
0
 private void PageSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     if (DocumentReader?.PageCount > e.NewValue)
     {
         DocumentReader.GoToPage((int)e.NewValue);
     }
 }
示例#2
0
        private void PageNumberTextBox_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }

            int pageNumber;

            if (int.TryParse(PageNumberTextBox.Text, out pageNumber))
            {
                DocumentReader.GoToPage(pageNumber);
            }
        }
示例#3
0
        private void LoadPreviousState()
        {
            Dispatcher.Invoke(() => { ResizeMode = ResizeMode.NoResize; });
            var pageCount = -1;
            var done      = false;

            while (!done)
            {
                Dispatcher.Invoke(() =>
                {
                    if (DocumentReader.PageCount != pageCount)
                    {
                        pageCount = DocumentReader.PageCount;
                    }
                    else
                    {
                        done = true;
                    }
                }
                                  );
                Thread.Sleep(100);
            }
            Dispatcher.Invoke(() =>
            {
                if (_state.CurrentBook != null)
                {
                    FinishLoadingDocument();
                    double newPageDouble = _state.CurrentBook.CurrentPage * DocumentReader.PageCount /
                                           _state.CurrentBook.PageCount;
                    var newPage = (int)Math.Ceiling(newPageDouble);
                    DocumentReader.GoToPage(newPage);
                }
            });

            Thread.Sleep(300);
            Dispatcher.Invoke(() => { ResizeMode = ResizeMode.CanResize; });
        }