names changed, layer of abstraction added
This commit is contained in:
@@ -24,7 +24,7 @@ using VDownload.Services.Data.Application;
|
|||||||
|
|
||||||
namespace VDownload.Core.ViewModels.Home
|
namespace VDownload.Core.ViewModels.Home
|
||||||
{
|
{
|
||||||
public partial class HomePlaylistViewModel : ObservableObject
|
public partial class HomeVideoCollectionViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
#region SERVICES
|
#region SERVICES
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ namespace VDownload.Core.ViewModels.Home
|
|||||||
|
|
||||||
#region FIELDS
|
#region FIELDS
|
||||||
|
|
||||||
protected Playlist _playlist;
|
protected VideoCollection _collection;
|
||||||
|
|
||||||
protected List<VideoViewModel> _removedVideos;
|
protected List<VideoViewModel> _removedVideos;
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ namespace VDownload.Core.ViewModels.Home
|
|||||||
|
|
||||||
#region CONSTRUCTORS
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
public HomePlaylistViewModel(IDownloadTaskManager tasksManager, ISettingsService settingsService, IStoragePickerService storagePickerService, IFilenameService filenameService, IDialogsService dialogsService, IStringResourcesService stringResourcesService, IApplicationDataService applicationDataService)
|
public HomeVideoCollectionViewModel(IDownloadTaskManager tasksManager, ISettingsService settingsService, IStoragePickerService storagePickerService, IFilenameService filenameService, IDialogsService dialogsService, IStringResourcesService stringResourcesService, IApplicationDataService applicationDataService)
|
||||||
{
|
{
|
||||||
_tasksManager = tasksManager;
|
_tasksManager = tasksManager;
|
||||||
_settingsService = settingsService;
|
_settingsService = settingsService;
|
||||||
@@ -202,10 +202,10 @@ namespace VDownload.Core.ViewModels.Home
|
|||||||
|
|
||||||
#region PUBLIC METHODS
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
public void LoadPlaylist(Playlist playlist)
|
public void LoadPlaylist(VideoCollection collection)
|
||||||
{
|
{
|
||||||
_playlist = playlist;
|
_collection = collection;
|
||||||
ParallelQuery<Video> playlistQuery = playlist.AsParallel();
|
ParallelQuery<Video> playlistQuery = _collection.AsParallel();
|
||||||
|
|
||||||
_removedVideos.Clear();
|
_removedVideos.Clear();
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ namespace VDownload.Core.ViewModels.Home
|
|||||||
_minViewsFilter = MinViews;
|
_minViewsFilter = MinViews;
|
||||||
_maxViewsFilter = MaxViews;
|
_maxViewsFilter = MaxViews;
|
||||||
|
|
||||||
IEnumerable<DateTimeOffset> date = playlist.Select(x => new DateTimeOffset(x.PublishDate));
|
IEnumerable<DateTimeOffset> date = _collection.Select(x => new DateTimeOffset(x.PublishDate));
|
||||||
MinDate = date.Min();
|
MinDate = date.Min();
|
||||||
MaxDate = date.Max();
|
MaxDate = date.Max();
|
||||||
_minDateFilter = MinDate;
|
_minDateFilter = MinDate;
|
||||||
@@ -230,9 +230,9 @@ namespace VDownload.Core.ViewModels.Home
|
|||||||
_minDurationFilter = MinDuration;
|
_minDurationFilter = MinDuration;
|
||||||
_maxDurationFilter = MaxDuration;
|
_maxDurationFilter = MaxDuration;
|
||||||
|
|
||||||
Name = _playlist.Name;
|
Name = _collection.Name;
|
||||||
Videos.Clear();
|
Videos.Clear();
|
||||||
foreach (Video video in playlist)
|
foreach (Video video in _collection)
|
||||||
{
|
{
|
||||||
Videos.Add(new VideoViewModel(video, _settingsService, _storagePickerService, _filenameService, _applicationDataService), true);
|
Videos.Add(new VideoViewModel(video, _settingsService, _storagePickerService, _filenameService, _applicationDataService), true);
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ namespace VDownload.Core.ViewModels.Home
|
|||||||
protected readonly IDownloadTaskManager _downloadTaskManager;
|
protected readonly IDownloadTaskManager _downloadTaskManager;
|
||||||
|
|
||||||
protected readonly HomeVideoViewModel _videoViewModel;
|
protected readonly HomeVideoViewModel _videoViewModel;
|
||||||
protected readonly HomePlaylistViewModel _playlistViewModel;
|
protected readonly HomeVideoCollectionViewModel _playlistViewModel;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ namespace VDownload.Core.ViewModels.Home
|
|||||||
|
|
||||||
protected readonly Type _downloadsView = typeof(HomeDownloadsViewModel);
|
protected readonly Type _downloadsView = typeof(HomeDownloadsViewModel);
|
||||||
protected readonly Type _videoView = typeof(HomeVideoViewModel);
|
protected readonly Type _videoView = typeof(HomeVideoViewModel);
|
||||||
protected readonly Type _playlistView = typeof(HomePlaylistViewModel);
|
protected readonly Type _playlistView = typeof(HomeVideoCollectionViewModel);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ namespace VDownload.Core.ViewModels.Home
|
|||||||
|
|
||||||
#region CONSTRUCTORS
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
public HomeViewModel(IConfigurationService configurationService, ISettingsService settingsService, IStringResourcesService stringResourcesService, ISearchService searchService, IDialogsService dialogsService, IDownloadTaskManager downloadTaskManager, HomeVideoViewModel videoViewModel, HomePlaylistViewModel playlistViewModel)
|
public HomeViewModel(IConfigurationService configurationService, ISettingsService settingsService, IStringResourcesService stringResourcesService, ISearchService searchService, IDialogsService dialogsService, IDownloadTaskManager downloadTaskManager, HomeVideoViewModel videoViewModel, HomeVideoCollectionViewModel playlistViewModel)
|
||||||
{
|
{
|
||||||
_configurationService = configurationService;
|
_configurationService = configurationService;
|
||||||
_settingsService = settingsService;
|
_settingsService = settingsService;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Page
|
<Page
|
||||||
x:Class="VDownload.Core.Views.Home.HomePlaylistView"
|
x:Class="VDownload.Core.Views.Home.HomeVideoCollectionView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="using:VDownload.Core.Views.Home"
|
xmlns:local="using:VDownload.Core.Views.Home"
|
||||||
@@ -16,11 +16,11 @@ using Windows.Foundation.Collections;
|
|||||||
|
|
||||||
namespace VDownload.Core.Views.Home
|
namespace VDownload.Core.Views.Home
|
||||||
{
|
{
|
||||||
public sealed partial class HomePlaylistView : Page
|
public sealed partial class HomeVideoCollectionView : Page
|
||||||
{
|
{
|
||||||
#region CONSTRUCTORS
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
public HomePlaylistView(HomePlaylistViewModel viewModel)
|
public HomeVideoCollectionView(HomeVideoCollectionViewModel viewModel)
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
this.DataContext = viewModel;
|
this.DataContext = viewModel;
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="About\AboutView.xaml" />
|
<None Remove="About\AboutView.xaml" />
|
||||||
<None Remove="Home\HomePlaylistView.xaml" />
|
<None Remove="Home\HomeVideoCollectionView.xaml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
<None Update="Home\HomeDownloadsView.xaml">
|
<None Update="Home\HomeDownloadsView.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</None>
|
</None>
|
||||||
<Page Update="Home\HomePlaylistView.xaml">
|
<Page Update="Home\HomeVideoCollectionView.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<None Update="Home\HomeVideoView.xaml">
|
<None Update="Home\HomeVideoView.xaml">
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace VDownload.Core.Views
|
|||||||
{ typeof(HomeViewModel), typeof(HomeView) },
|
{ typeof(HomeViewModel), typeof(HomeView) },
|
||||||
{ typeof(HomeDownloadsViewModel), typeof(HomeDownloadsView) },
|
{ typeof(HomeDownloadsViewModel), typeof(HomeDownloadsView) },
|
||||||
{ typeof(HomeVideoViewModel), typeof(HomeVideoView) },
|
{ typeof(HomeVideoViewModel), typeof(HomeVideoView) },
|
||||||
{ typeof(HomePlaylistViewModel), typeof(HomePlaylistView) },
|
{ typeof(HomeVideoCollectionViewModel), typeof(HomeVideoCollectionView) },
|
||||||
{ typeof(SettingsViewModel), typeof(SettingsView) },
|
{ typeof(SettingsViewModel), typeof(SettingsView) },
|
||||||
{ typeof(AboutViewModel), typeof(AboutView) },
|
{ typeof(AboutViewModel), typeof(AboutView) },
|
||||||
{ typeof(AuthenticationViewModel), typeof(AuthenticationView) }
|
{ typeof(AuthenticationViewModel), typeof(AuthenticationView) }
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace VDownload.Models
|
namespace VDownload.Models
|
||||||
{
|
{
|
||||||
public abstract class Playlist : List<Video>
|
public abstract class Playlist : VideoCollection
|
||||||
{
|
{
|
||||||
#region PROPERTIES
|
#region PROPERTIES
|
||||||
|
|
||||||
public required string Name { get; set; }
|
|
||||||
public required string Description { get; set; }
|
public required string Description { get; set; }
|
||||||
public required Uri Url { get; set; }
|
public required Uri Url { get; set; }
|
||||||
public Source Source { get; protected set; }
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace VDownload.Models
|
|||||||
{
|
{
|
||||||
public enum Source
|
public enum Source
|
||||||
{
|
{
|
||||||
Twitch
|
Twitch,
|
||||||
|
Subscriptions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
20
VDownload.Models/SubscriptionList.cs
Normal file
20
VDownload.Models/SubscriptionList.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace VDownload.Models
|
||||||
|
{
|
||||||
|
public class SubscriptionList : VideoCollection
|
||||||
|
{
|
||||||
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
|
public SubscriptionList()
|
||||||
|
{
|
||||||
|
Source = Source.Subscriptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
18
VDownload.Models/VideoCollection.cs
Normal file
18
VDownload.Models/VideoCollection.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace VDownload.Models
|
||||||
|
{
|
||||||
|
public abstract class VideoCollection : List<Video>
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public required string Name { get; init; }
|
||||||
|
public Source Source { get; protected set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -154,7 +154,7 @@ namespace VDownload
|
|||||||
services.AddSingleton<SettingsViewModel>();
|
services.AddSingleton<SettingsViewModel>();
|
||||||
services.AddSingleton<HomeDownloadsViewModel>();
|
services.AddSingleton<HomeDownloadsViewModel>();
|
||||||
services.AddSingleton<HomeVideoViewModel>();
|
services.AddSingleton<HomeVideoViewModel>();
|
||||||
services.AddSingleton<HomePlaylistViewModel>();
|
services.AddSingleton<HomeVideoCollectionViewModel>();
|
||||||
services.AddSingleton<HomeViewModel>();
|
services.AddSingleton<HomeViewModel>();
|
||||||
services.AddSingleton<BaseViewModel>();
|
services.AddSingleton<BaseViewModel>();
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ namespace VDownload
|
|||||||
services.AddTransient<SettingsView>();
|
services.AddTransient<SettingsView>();
|
||||||
services.AddTransient<HomeDownloadsView>();
|
services.AddTransient<HomeDownloadsView>();
|
||||||
services.AddTransient<HomeVideoView>();
|
services.AddTransient<HomeVideoView>();
|
||||||
services.AddTransient<HomePlaylistView>();
|
services.AddTransient<HomeVideoCollectionView>();
|
||||||
services.AddTransient<HomeView>();
|
services.AddTransient<HomeView>();
|
||||||
services.AddTransient<BaseWindow>();
|
services.AddTransient<BaseWindow>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user