summary refs log tree commit diff
path: root/BatchBeatmapDownloader/ViewModels/MainWindowViewModel.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-10-09 00:26:46 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-10-09 00:26:46 +0200
commitbef1d59cffaae749661d0a5d90914839a54cc8e7 (patch)
treea05a726d27567bed093e77c194b1e0f9d2ac700f /BatchBeatmapDownloader/ViewModels/MainWindowViewModel.cs
downloadBatchBeatmapDownloader-master.tar.xz
Initial commit HEAD master
Diffstat (limited to 'BatchBeatmapDownloader/ViewModels/MainWindowViewModel.cs')
-rw-r--r--BatchBeatmapDownloader/ViewModels/MainWindowViewModel.cs31
1 files changed, 31 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));
+	}
+}