diff --git a/src/TumblThree/TumblThree.Applications/Controllers/QueueController.cs b/src/TumblThree/TumblThree.Applications/Controllers/QueueController.cs index e3d69625..1be06ed7 100644 --- a/src/TumblThree/TumblThree.Applications/Controllers/QueueController.cs +++ b/src/TumblThree/TumblThree.Applications/Controllers/QueueController.cs @@ -228,7 +228,9 @@ private void CrawlerServiceActiveItemsCollectionChanged(object sender, NotifyCol { if (_crawlerService.ActiveItems.Count > 0) { - _detailsService.UpdateBlogPreview(_crawlerService.ActiveItems.OrderByDescending(x => x.Blog.LastPreviewShown).Take(1).Select(x => x.Blog).ToArray()); + IBlog[] blogs = _crawlerService.ActiveItems.OrderByDescending(x => x.Blog.LastPreviewShown) + .SkipWhile(x => _crawlerService.ActiveItems.Count > 1 && x.Blog == _crawlerService.LastDeselectedPreview).Take(1).Select(x => x.Blog).ToArray(); + _detailsService.UpdateBlogPreview(blogs); } } diff --git a/src/TumblThree/TumblThree.Applications/Services/CrawlerService.cs b/src/TumblThree/TumblThree.Applications/Services/CrawlerService.cs index 7b697c55..01a219b6 100644 --- a/src/TumblThree/TumblThree.Applications/Services/CrawlerService.cs +++ b/src/TumblThree/TumblThree.Applications/Services/CrawlerService.cs @@ -11,6 +11,7 @@ using System.Windows.Data; using System.Windows.Input; using TumblThree.Domain.Models; +using TumblThree.Domain.Models.Blogs; using TumblThree.Domain.Queue; namespace TumblThree.Applications.Services @@ -53,6 +54,7 @@ public class CrawlerService : Model, ICrawlerService private Timer _timer; private string _isTextVis; private bool _isToolTipActive; + private IBlog _lastDeselectedPreview; [ImportingConstructor] public CrawlerService(IShellService shellService) @@ -254,6 +256,12 @@ public string NewBlogUrl set => SetProperty(ref _newBlogUrl, value); } + public IBlog LastDeselectedPreview + { + get => _lastDeselectedPreview; + set => SetProperty(ref _lastDeselectedPreview, value); + } + public int ActiveCollectionId { get diff --git a/src/TumblThree/TumblThree.Applications/Services/ICrawlerService.cs b/src/TumblThree/TumblThree.Applications/Services/ICrawlerService.cs index 7a632691..543da09a 100644 --- a/src/TumblThree/TumblThree.Applications/Services/ICrawlerService.cs +++ b/src/TumblThree/TumblThree.Applications/Services/ICrawlerService.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using System.Waf.Foundation; using System.Windows.Input; +using TumblThree.Domain.Models.Blogs; using TumblThree.Domain.Queue; namespace TumblThree.Applications.Services @@ -54,6 +55,8 @@ public interface ICrawlerService : INotifyPropertyChanged string NewBlogUrl { get; set; } + IBlog LastDeselectedPreview { get; set; } + int ActiveCollectionId { get; set; } IReadOnlyObservableList ActiveItems { get; } diff --git a/src/TumblThree/TumblThree.Presentation/DesignData/MockCrawlerService.cs b/src/TumblThree/TumblThree.Presentation/DesignData/MockCrawlerService.cs index 999fe622..594ababf 100644 --- a/src/TumblThree/TumblThree.Presentation/DesignData/MockCrawlerService.cs +++ b/src/TumblThree/TumblThree.Presentation/DesignData/MockCrawlerService.cs @@ -89,6 +89,8 @@ public void UpdateCollectionsList(bool isInit) public string NewBlogUrl { get; set; } + public IBlog LastDeselectedPreview { get; set; } + public int ActiveCollectionId { get; set; } public Guava.RateLimiter.RateLimiter TimeconstraintApi { get; set; } diff --git a/src/TumblThree/TumblThree.Presentation/Views/ManagerView.xaml.cs b/src/TumblThree/TumblThree.Presentation/Views/ManagerView.xaml.cs index c3232e3b..8a7a761a 100644 --- a/src/TumblThree/TumblThree.Presentation/Views/ManagerView.xaml.cs +++ b/src/TumblThree/TumblThree.Presentation/Views/ManagerView.xaml.cs @@ -44,6 +44,10 @@ private void SelectionChanged(object sender, SelectionChangedEventArgs e) { ViewModel.SelectionService.RemoveRange(e.RemovedItems.Cast()); ViewModel.SelectionService.AddRange(e.AddedItems.Cast()); + if (e.RemovedItems.Count == 1) + { + ViewModel.CrawlerService.LastDeselectedPreview = (IBlog)e.RemovedItems[0]; + } } private ManagerViewModel ViewModel