コード例 #1
0
        private void LoadNextSlides(bool isToSelectNextSlide = true)
        {
            var newNextSlideIndex = _nextSlideIndex;

            if (_nextSlideIndex + 1 < this.GetCurrentPresentation().SlideCount)
            {
                var nextSlide = this.GetCurrentPresentation().Slides[_nextSlideIndex + 1];
                newNextSlideIndex = _nextSlideIndex + 1;
                AddSlideThumbnail(nextSlide);
            }

            if (_nextSlideIndex + 2 < this.GetCurrentPresentation().SlideCount)
            {
                var nextSlide = this.GetCurrentPresentation().Slides[_nextSlideIndex + 2];
                newNextSlideIndex = _nextSlideIndex + 2;
                AddSlideThumbnail(nextSlide);
            }

            if (_nextSlideIndex + 3 < this.GetCurrentPresentation().SlideCount)
            {
                var nextSlide = this.GetCurrentPresentation().Slides[_nextSlideIndex + 3];
                newNextSlideIndex = _nextSlideIndex + 3;
                AddSlideThumbnail(nextSlide);
            }

            _nextSlideIndex = newNextSlideIndex;
            if (SlideListBox.SelectedIndex + 1 < SlideListBox.Items.Count && isToSelectNextSlide)
            {
                SlideListBox.SelectedIndex = SlideListBox.SelectedIndex + 1;
            }
            SlideListBox.ScrollIntoView(SlideListBox.Items[SlideListBox.SelectedIndex]);
        }
コード例 #2
0
        private void LoadPreviousSlides(bool isToSelectPrevSlide = true)
        {
            var newPrevSlideIndex = _prevSlideIndex;

            if (_prevSlideIndex - 3 >= 0)
            {
                newPrevSlideIndex = _prevSlideIndex - 3;
                var prevSlide = this.GetCurrentPresentation().Slides[_prevSlideIndex - 3];
                AddSlideThumbnail(prevSlide, 0);
            }

            if (_prevSlideIndex - 2 >= 0)
            {
                var prevSlide = this.GetCurrentPresentation().Slides[_prevSlideIndex - 2];
                if (_prevSlideIndex - 3 >= 0)
                {
                    AddSlideThumbnail(prevSlide, 1);
                }
                else
                {
                    newPrevSlideIndex = _prevSlideIndex - 2;
                    AddSlideThumbnail(prevSlide, 0);
                }
            }

            if (_prevSlideIndex - 1 >= 0)
            {
                var prevSlide = this.GetCurrentPresentation().Slides[_prevSlideIndex - 1];
                if (_prevSlideIndex - 3 >= 0)
                {
                    AddSlideThumbnail(prevSlide, 2);
                }
                else if (_prevSlideIndex - 2 >= 0)
                {
                    AddSlideThumbnail(prevSlide, 1);
                }
                else
                {
                    newPrevSlideIndex = _prevSlideIndex - 1;
                    AddSlideThumbnail(prevSlide, 0);
                }
            }

            _prevSlideIndex = newPrevSlideIndex;
            if (SlideListBox.SelectedIndex - 1 >= 0 && isToSelectPrevSlide)
            {
                SlideListBox.SelectedIndex = SlideListBox.SelectedIndex - 1;
            }
            SlideListBox.ScrollIntoView(SlideListBox.Items[SlideListBox.SelectedIndex]);
        }
コード例 #3
0
        private void NextButton_OnClick(object sender, RoutedEventArgs e)
        {
            var selectedIndex = SlideListBox.SelectedIndex;

            if (selectedIndex + 1 < SlideListBox.Items.Count)
            {
                SlideListBox.SelectedIndex = selectedIndex + 1;
                SlideListBox.ScrollIntoView(SlideListBox.Items[SlideListBox.SelectedIndex]);
            }
            else
            {
                LoadNextSlides();
            }
        }
コード例 #4
0
        private void PrevButton_OnClick(object sender, RoutedEventArgs e)
        {
            var selectedIndex = SlideListBox.SelectedIndex;

            if (selectedIndex - 1 >= 0)
            {
                SlideListBox.SelectedIndex = selectedIndex - 1;
                SlideListBox.ScrollIntoView(SlideListBox.Items[SlideListBox.SelectedIndex]);
            }
            else
            {
                LoadPreviousSlides();
            }
        }
コード例 #5
0
        /// <summary>
        /// This method can only be called after dialog is fully initialized
        /// </summary>
        /// <param name="title"></param>
        public SlideSelectionDialog Init(string title)
        {
            DialogTitleProperty.Text = title;
            Dispatcher.Invoke(new Action(() =>
            {
                SlideList.Clear();
            }));
            var currentSlide = this.GetCurrentSlide();

            if (currentSlide.Index - 2 >= 0)
            {
                _prevSlideIndex = currentSlide.Index - 2;
                var prevSlide = this.GetCurrentPresentation().Slides[currentSlide.Index - 2];
                AddSlideThumbnail(prevSlide);
            }
            else
            {
                _prevSlideIndex = currentSlide.Index - 1;
            }

            AddSlideThumbnail(currentSlide, isCurrentSlide: true);

            if (currentSlide.Index < this.GetCurrentPresentation().SlideCount)
            {
                _nextSlideIndex = currentSlide.Index;
                var nextSlide = this.GetCurrentPresentation().Slides[currentSlide.Index];
                AddSlideThumbnail(nextSlide);
            }
            else
            {
                _nextSlideIndex = currentSlide.Index - 1;
            }

            SelectCurrentSlide();

            LoadNextSlides(false);
            SlideListBox.ScrollIntoView(SlideListBox.SelectedItem);
            return(this);
        }