summary refs log tree commit diff
path: root/BatchBeatmapDownloader/ViewModels/MainWindowViewModel.cs
diff options
context:
space:
mode:
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));
+	}
+}