about summary refs log tree commit diff
path: root/ModerationClient/Services/StatusBarService.cs
blob: f1d7223c49985c1ca024e7b7dea734c1f4a2f982 (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
34
35
36
37
using System;
using System.Collections.ObjectModel;
using ArcaneLibs;

namespace ModerationClient.Services;

public class StatusBarService : NotifyPropertyChanged {
    private string _statusText = "Ready";
    private bool _isBusy;

    public string StatusText {
        get => _statusText + " " + DateTime.Now.ToString("u")[..^1];
        set => SetField(ref _statusText, value);
    }

    public bool IsBusy {
        get => _isBusy;
        set => SetField(ref _isBusy, value);
    }
    
    public ObservableCollection<Progress> ProgressBars { get; } = new();
    
    
    public class Progress : NotifyPropertyChanged {
        public Progress(int total) {
            Total = total;
        }

        public int Total { get; }
        public int Current { get; private set; }

        public void Increment() {
            Current++;
            OnPropertyChanged(nameof(Current));
        }
    }
}