about summary refs log tree commit diff
path: root/ModerationClient/ViewModels/MainWindowViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ModerationClient/ViewModels/MainWindowViewModel.cs')
-rw-r--r--ModerationClient/ViewModels/MainWindowViewModel.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/ModerationClient/ViewModels/MainWindowViewModel.cs b/ModerationClient/ViewModels/MainWindowViewModel.cs
new file mode 100644
index 0000000..01ec6d6
--- /dev/null
+++ b/ModerationClient/ViewModels/MainWindowViewModel.cs
@@ -0,0 +1,33 @@
+using System;
+using ModerationClient.Services;
+using ModerationClient.Views;
+
+namespace ModerationClient.ViewModels;
+
+public partial class MainWindowViewModel(MatrixAuthenticationService authService, CommandLineConfiguration cfg) : ViewModelBase {
+    public MainWindow? MainWindow { get; set; }
+    
+    private float _scale = 1.0f;
+    private ViewModelBase _currentViewModel = new LoginViewModel(authService);
+
+    public ViewModelBase CurrentViewModel {
+        get => _currentViewModel;
+        set => SetProperty(ref _currentViewModel, value);
+    }
+
+    public CommandLineConfiguration CommandLineConfiguration { get; } = cfg;
+    public MatrixAuthenticationService AuthService { get; } = authService;
+
+    public float Scale {
+        get => _scale;
+        set {
+            SetProperty(ref _scale, (float)Math.Round(value, 2));
+            OnPropertyChanged(nameof(ChildTargetWidth));
+            OnPropertyChanged(nameof(ChildTargetHeight));
+        }
+    }
+    public int ChildTargetWidth => (int)(MainWindow?.Width / Scale ?? 1);
+    public int ChildTargetHeight => (int)(MainWindow?.Height / Scale ?? 1);
+
+    
+}
\ No newline at end of file