/// <summary>
        /// Populate the document viewer
        /// </summary>
        /// <param name="cluster">The cluster</param>
        /// <param name="searchResultDictionary">The document from the search results</param>
        /// <param name="displayMode">The display mode for the document viewer</param>
        /// <param name="kindFilters">Kind filter to decide which results to include</param>
        /// <param name="providerFilters">Provider filter to decide which results to include</param>
        public void Populate(SearchCluster cluster, Dictionary <Guid, SearchAggregateItem> searchResultDictionary, DocumentViewerDisplayMode displayMode, List <string> kindFilters, List <string> providerFilters)
        {
            carousel.HookHidEvents(false);
            carousel.HookHidEvents(true);

            Action openDocumentViewer = delegate()
            {
                listBoxSearchItems.ItemsSource = null;
                carousel.ItemsSource           = null;

                documentViewerTitle.Text = cluster.Title;

                ShumbiDiscover.Controls.Converters.SearchAggregateItemRankConverter.ProviderFilters      = providerFilters;
                ShumbiDiscover.Controls.Converters.SearchAggregateItemProvidersConverter.ProviderFilters = providerFilters;

                List <SearchAggregateItem> items = new List <SearchAggregateItem>();

                PopulateDocumentViewerFromCluster(cluster, searchResultDictionary, items, kindFilters, providerFilters);

                items.Sort(new SearchAggregateItemComparer(providerFilters));

                carousel.ItemsSource           = items;
                listBoxSearchItems.ItemsSource = items;

                scrollNavigator.Minimum = 0;
                scrollNavigator.Maximum = items.Count - 1;

                if (listBoxSearchItems.Items.Count > 0)
                {
                    listBoxSearchItems.SelectedIndex = 0;
                }

                _displayMode             = displayMode;
                buttonCarousel.IsChecked = _displayMode == DocumentViewerDisplayMode.Carousel;
                buttonList.IsChecked     = _displayMode == DocumentViewerDisplayMode.List;
                gridCarousel.Visibility  = _displayMode == DocumentViewerDisplayMode.Carousel ? Visibility.Visible : Visibility.Collapsed;
                gridList.Visibility      = _displayMode == DocumentViewerDisplayMode.List ? Visibility.Visible : Visibility.Collapsed;

                List <SearchAggregateItem> missingThumbs = new List <SearchAggregateItem>();

                foreach (SearchAggregateItem searchAggregateItem in items)
                {
                    if (string.IsNullOrEmpty(searchAggregateItem.ThumbnailUrl))
                    {
                        missingThumbs.Add(searchAggregateItem);
                        ThumbnailManager.Instance.GetThumbnail(searchAggregateItem.OpenUrl, 300, 300, true, searchAggregateItem, new ThumbnailCompletedEventHandler(ThumbnailCompleted));
                    }
                }
                foreach (SearchAggregateItem searchAggregateItem in missingThumbs)
                {
                    ThumbnailManager.Instance.GetThumbnail(searchAggregateItem.OpenUrl, 300, 300, false, searchAggregateItem, new ThumbnailCompletedEventHandler(ThumbnailCompleted));
                }
            };

            Dispatcher.BeginInvoke(openDocumentViewer);
        }
 private void buttonList_Click(object sender, RoutedEventArgs e)
 {
     buttonCarousel.IsChecked = false;
     buttonList.IsChecked     = true;
     gridCarousel.Visibility  = Visibility.Collapsed;
     gridList.Visibility      = Visibility.Visible;
     _displayMode             = DocumentViewerDisplayMode.List;
     if (DisplayModeChanged != null)
     {
         DisplayModeChanged(_displayMode);
     }
 }
 void documentViewer_DisplayModeChanged(DocumentViewerDisplayMode displayMode)
 {
     if (_currentSearchVisualisation != null)
     {
         _currentSearchVisualisation.DocumentViewerDisplayMode = displayMode;
     }
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 public SearchVisualisation()
 {
     _documentViewDisplayMode = DocumentViewerDisplayMode.Carousel;
 }