about summary refs log tree commit diff
path: root/ModerationClient/ViewModels/MainWindowViewModel.cs
blob: 01ec6d65d15d076ac97dc3d807210f34d2bbd444 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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);

    
}