mirror of
https://github.com/4sval/FModel.git
synced 2026-09-27 03:27:59 -05:00
implemented loading label
This commit is contained in:
45
FModel/Framework/FStatus.cs
Normal file
45
FModel/Framework/FStatus.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
namespace FModel.Framework;
|
||||
|
||||
public class FStatus : ViewModel
|
||||
{
|
||||
private bool _isReady;
|
||||
public bool IsReady
|
||||
{
|
||||
get => _isReady;
|
||||
private set => SetProperty(ref _isReady, value);
|
||||
}
|
||||
|
||||
private EStatusKind _kind;
|
||||
public EStatusKind Kind
|
||||
{
|
||||
get => _kind;
|
||||
private set
|
||||
{
|
||||
SetProperty(ref _kind, value);
|
||||
IsReady = Kind != EStatusKind.Loading && Kind != EStatusKind.Stopping;
|
||||
}
|
||||
}
|
||||
|
||||
private string _label;
|
||||
public string Label
|
||||
{
|
||||
get => _label;
|
||||
private set => SetProperty(ref _label, value);
|
||||
}
|
||||
|
||||
public FStatus()
|
||||
{
|
||||
SetStatus(EStatusKind.Loading);
|
||||
}
|
||||
|
||||
public void SetStatus(EStatusKind kind, string label = "")
|
||||
{
|
||||
Kind = kind;
|
||||
UpdateStatusLabel(label);
|
||||
}
|
||||
|
||||
public void UpdateStatusLabel(string label)
|
||||
{
|
||||
Label = Kind == EStatusKind.Loading ? $"{Kind} {label}".Trim() : Kind.ToString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user