summary refs log tree commit diff
path: root/BatchBeatmapDownloader/ViewModels
diff options
context:
space:
mode:
Diffstat (limited to 'BatchBeatmapDownloader/ViewModels')
-rw-r--r--BatchBeatmapDownloader/ViewModels/MainWindowViewModel.cs31
-rw-r--r--BatchBeatmapDownloader/ViewModels/ViewModelBase.cs5
2 files changed, 36 insertions, 0 deletions
diff --git a/BatchBeatmapDownloader/ViewModels/MainWindowViewModel.cs b/BatchBeatmapDownloader/ViewModels/MainWindowViewModel.cs
new file mode 100644

index 0000000..1e5d23a --- /dev/null +++ b/BatchBeatmapDownloader/ViewModels/MainWindowViewModel.cs
@@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using LibBeatmapDownload; +using ReactiveUI; + +namespace BatchBeatmapDownloader.ViewModels; + +public class MainWindowViewModel : ViewModelBase { + // public List<DownloadTask> DownloadTasks { get; set; } = new(); + public DownloadTaskList DownloadTasks { get; set; } = new(); + + private int _windowWidth = 800; + + public int WindowWidth { + set { + _windowWidth = value; + Debug.WriteLine($"Window width: {_windowWidth}"); + DomainStatsChunked = DownloadTask.MirrorStats.Select(x => x.Value).ToList().Chunk(value/300) + .Select(x => new ObjectCollectionWrapper<DomainStats>(x)).ToList(); + this.RaisePropertyChanged(nameof(DomainStatsChunked)); + } + } + + public List<ObjectCollectionWrapper<DomainStats>> DomainStatsChunked { get; set; } = DownloadTask.MirrorStats.Select(x => x.Value).ToList().Chunk(2) + .Select(x => new ObjectCollectionWrapper<DomainStats>(x)).ToList(); + + public void RaiseDownloadListChanged() { + this.RaisePropertyChanged(nameof(DownloadTasks)); + } +} diff --git a/BatchBeatmapDownloader/ViewModels/ViewModelBase.cs b/BatchBeatmapDownloader/ViewModels/ViewModelBase.cs new file mode 100644
index 0000000..e0f04e3 --- /dev/null +++ b/BatchBeatmapDownloader/ViewModels/ViewModelBase.cs
@@ -0,0 +1,5 @@ +using ReactiveUI; + +namespace BatchBeatmapDownloader.ViewModels; + +public class ViewModelBase : ReactiveObject { }