From bef1d59cffaae749661d0a5d90914839a54cc8e7 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 9 Oct 2023 00:26:46 +0200 Subject: Initial commit --- .../ViewModels/MainWindowViewModel.cs | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 BatchBeatmapDownloader/ViewModels/MainWindowViewModel.cs (limited to 'BatchBeatmapDownloader/ViewModels/MainWindowViewModel.cs') 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 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(x)).ToList(); + this.RaisePropertyChanged(nameof(DomainStatsChunked)); + } + } + + public List> DomainStatsChunked { get; set; } = DownloadTask.MirrorStats.Select(x => x.Value).ToList().Chunk(2) + .Select(x => new ObjectCollectionWrapper(x)).ToList(); + + public void RaiseDownloadListChanged() { + this.RaisePropertyChanged(nameof(DownloadTasks)); + } +} -- cgit 1.5.1