예제 #1
0
        public void PopulateThumbnailBoxes(ICollection <ThumbnailInfo> thumbnails)
        {
            foreach (var aThumbnail in thumbnails)
            {
                var aThumbnailBox = new ThumbnailBox(aThumbnail);
                aThumbnail.ThumbnailBox = aThumbnailBox;

                aThumbnailBox.ThumbnailBoxClicked +=
                    (sender, e) =>
                {
                    var thumbnailBox = sender as ThumbnailBox;

                    if (thumbnailBox.IsSelected)
                    {
                        DisplayImage();
                    }
                    else
                    {
                        SelectThumbnailBox(thumbnailBox);
                    }
                };

                _thumbnailBoxList.Add(aThumbnailBox);

                if (_thumbnailBoxList.Count == 1)
                {
                    SelectThumbnailBox(aThumbnailBox);
                    _thumbnailScrollViewer.Focus();
                }

                var aSurroundingStackPanel = new StackPanel();
                aSurroundingStackPanel.Children.Add(aThumbnailBox);
                _thumbnailWrapPanel.Children.Add(aSurroundingStackPanel);
            }
        }
예제 #2
0
        private void SelectThumbnailBox(ThumbnailBox thumbnailBox)
        {
            if (_selectedThumbnailBox != thumbnailBox)
            {
                if (_selectedThumbnailBox != null)
                {
                    _selectedThumbnailBox.UnselectThumbnail();
                }

                _selectedThumbnailBox   = thumbnailBox;
                _selectedThumbnailIndex = _thumbnailBoxList
                                          .FindIndex(aThumbnailBox =>
                                                     aThumbnailBox == _selectedThumbnailBox);

                _selectedThumbnailBox.SelectThumbnail();
            }
        }
예제 #3
0
        private void AdvanceToThumbnailIndex(int increment)
        {
            if (_selectedThumbnailBox != null)
            {
                var newSelectedThumbnailIndex = _selectedThumbnailIndex + increment;

                if ((newSelectedThumbnailIndex >= 0) &&
                    (newSelectedThumbnailIndex < _thumbnailBoxList.Count))
                {
                    _selectedThumbnailBox.UnselectThumbnail();

                    _selectedThumbnailIndex = newSelectedThumbnailIndex;
                    _selectedThumbnailBox   = _thumbnailBoxList[_selectedThumbnailIndex];

                    _selectedThumbnailBox.SelectThumbnail();
                }
            }
        }
 public GeneratingEventArgs(ThumbnailBox tb)
 {
     this._tb = tb;
 }
예제 #5
0
 public GeneratingEventArgs(ThumbnailBox tb)
 {
     this._tb = tb;
 }
 public void RefreshThumbnail()
 => ThumbnailBox.Refresh();