diff --git a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/HomePlaylistViewResources.resw b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/HomePlaylistViewResources.resw
index 2eb1753..874d57f 100644
--- a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/HomePlaylistViewResources.resw
+++ b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/HomePlaylistViewResources.resw
@@ -174,6 +174,9 @@
Filter
+
+ Hidden:
+
Media options
diff --git a/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs
index f8b137d..c164796 100644
--- a/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs
+++ b/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs
@@ -14,6 +14,7 @@ using VDownload.Models;
using VDownload.Services.Data.Settings;
using VDownload.Services.UI.StoragePicker;
using VDownload.Sources.Twitch.Configuration.Models;
+using SimpleToolkit.MVVM;
namespace VDownload.Core.ViewModels.Home
{
@@ -34,7 +35,7 @@ namespace VDownload.Core.ViewModels.Home
protected Playlist _playlist;
- protected Dictionary _allVideos;
+ protected List _removedVideos;
#endregion
@@ -46,11 +47,17 @@ namespace VDownload.Core.ViewModels.Home
protected string _name;
[ObservableProperty]
- protected ObservableCollection _videos;
+ protected ObservableDictionary _videos;
[ObservableProperty]
protected int _removedCount;
+ [ObservableProperty]
+ protected int _hiddenCount;
+
+ [ObservableProperty]
+ protected bool _isSomethingHidden;
+
#endregion
@@ -63,8 +70,9 @@ namespace VDownload.Core.ViewModels.Home
_settingsService = settingsService;
_storagePickerService = storagePickerService;
- _allVideos = new Dictionary();
- _videos = new ObservableCollection();
+ _removedVideos = new List();
+
+ _videos = new ObservableDictionary();
}
#endregion
@@ -77,15 +85,15 @@ namespace VDownload.Core.ViewModels.Home
{
_playlist = playlist;
- _allVideos.Clear();
- foreach (Video video in playlist)
- {
- _allVideos.Add(new VideoViewModel(video, _settingsService, _storagePickerService), false);
- }
+ _removedVideos.Clear();
Name = _playlist.Name;
- Videos = new ObservableCollection(_allVideos.Keys);
- RemovedCount = 0;
+ Videos.Clear();
+ foreach (Video video in playlist)
+ {
+ Videos.Add(new VideoViewModel(video, _settingsService, _storagePickerService), true);
+ }
+ UpdateCounters();
}
#endregion
@@ -100,7 +108,7 @@ namespace VDownload.Core.ViewModels.Home
string? newDirectory = await _storagePickerService.OpenDirectory();
if (newDirectory is not null)
{
- foreach (VideoViewModel video in _allVideos.Keys)
+ foreach (VideoViewModel video in Videos.Keys)
{
video.DirectoryPath = newDirectory;
}
@@ -110,22 +118,23 @@ namespace VDownload.Core.ViewModels.Home
[RelayCommand]
public void RemoveVideo(VideoViewModel video)
{
- _allVideos[video] = true;
+ Videos[video] = false;
- Videos.Remove(video);
+ _removedVideos.Add(video);
- RemovedCount = _allVideos.Where(x => x.Value).Count();
+ UpdateCounters();
}
[RelayCommand]
public void RestoreRemovedVideos()
{
- foreach(VideoViewModel video in _allVideos.Where(x => x.Value == true).Select(x => x.Key))
+ foreach(VideoViewModel video in _removedVideos)
{
- _allVideos[video] = false;
- Videos.Add(video);
+ Videos[video] = true;
}
- RemovedCount = _allVideos.Where(x => x.Value).Count();
+ _removedVideos.Clear();
+
+ UpdateCounters();
}
[RelayCommand]
@@ -142,7 +151,7 @@ namespace VDownload.Core.ViewModels.Home
protected void CreateTasks(bool download)
{
- foreach (VideoViewModel video in Videos)
+ foreach (VideoViewModel video in Videos.Keys)
{
DownloadTask task = _tasksManager.AddTask(video.Video, video.BuildDownloadOptions());
if (download)
@@ -153,6 +162,13 @@ namespace VDownload.Core.ViewModels.Home
CloseRequested?.Invoke(this, EventArgs.Empty);
}
+ protected void UpdateCounters()
+ {
+ RemovedCount = _removedVideos.Count;
+ HiddenCount = Videos.Values.Where(x => !x).Count();
+ IsSomethingHidden = HiddenCount > 0;
+ }
+
#endregion
diff --git a/VDownload.Core/VDownload.Core.ViewModels/VDownload.Core.ViewModels.csproj b/VDownload.Core/VDownload.Core.ViewModels/VDownload.Core.ViewModels.csproj
index db183b6..d4e9bf9 100644
--- a/VDownload.Core/VDownload.Core.ViewModels/VDownload.Core.ViewModels.csproj
+++ b/VDownload.Core/VDownload.Core.ViewModels/VDownload.Core.ViewModels.csproj
@@ -13,7 +13,8 @@
-
+
+
diff --git a/VDownload.Core/VDownload.Core.Views/Home/HomePlaylistView.xaml b/VDownload.Core/VDownload.Core.Views/Home/HomePlaylistView.xaml
index 2acef50..e86504d 100644
--- a/VDownload.Core/VDownload.Core.Views/Home/HomePlaylistView.xaml
+++ b/VDownload.Core/VDownload.Core.Views/Home/HomePlaylistView.xaml
@@ -37,7 +37,12 @@
TextWrapping="WrapWholeWords"/>
+ Margin="-5"
+ Spacing="10">
+
+
+
+ HorizontalContentAlignment="Stretch"
+ Visibility="{Binding Value, Converter={StaticResource BoolToVisibilityConverter}}">
@@ -174,7 +180,7 @@
+ Text="{Binding Key.Author}"/>
+ Text="{Binding Key.PublishDate}"/>
+ Text="{Binding Key.Duration}"/>
+ Text="{Binding Key.Views}"/>
+ CommandParameter="{Binding Key}"/>
@@ -267,8 +273,8 @@
-
+
@@ -276,7 +282,7 @@
UriSource="{ThemeResource ImageHomePlaylistViewMedia}"/>
+ SelectedItem="{Binding Key.MediaType, Mode=TwoWay}">
@@ -301,13 +307,13 @@
-
+
-
+
@@ -317,20 +323,20 @@
FontWeight="Bold"
FontSize="15"/>
+ Description="{Binding Key.DirectoryPath}">
+ Command="{Binding Key.BrowseCommand}"/>
-
+
@@ -338,13 +344,13 @@
UriSource="{ThemeResource ImageHomePlaylistViewExtension}"/>
-
+ SelectedItem="{Binding Key.AudioExtension, Mode=TwoWay}">
@@ -354,13 +360,13 @@
-
+ SelectedItem="{Binding Key.VideoExtension, Mode=TwoWay}">
diff --git a/VDownload.Core/VDownload.Core.Views/VDownload.Core.Views.csproj b/VDownload.Core/VDownload.Core.Views/VDownload.Core.Views.csproj
index 2c389d3..70632f0 100644
--- a/VDownload.Core/VDownload.Core.Views/VDownload.Core.Views.csproj
+++ b/VDownload.Core/VDownload.Core.Views/VDownload.Core.Views.csproj
@@ -21,8 +21,8 @@
-
-
+
+
diff --git a/VDownload/VDownload.csproj b/VDownload/VDownload.csproj
index bc5d2df..51dc1fe 100644
--- a/VDownload/VDownload.csproj
+++ b/VDownload/VDownload.csproj
@@ -155,7 +155,7 @@
-
+