You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
832 B
28 lines
832 B
1 year ago
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||
|
|
||
1 year ago
|
namespace StabilityMatrix.Avalonia.ViewModels.Base;
|
||
1 year ago
|
|
||
|
/// <summary>
|
||
|
/// Generic view model for progress reporting.
|
||
|
/// </summary>
|
||
1 year ago
|
public partial class ProgressViewModel : ViewModelBase
|
||
1 year ago
|
{
|
||
1 year ago
|
[ObservableProperty, NotifyPropertyChangedFor(nameof(IsTextVisible))]
|
||
1 year ago
|
private string? text;
|
||
1 year ago
|
|
||
|
[ObservableProperty]
|
||
|
private string? description;
|
||
1 year ago
|
|
||
1 year ago
|
[ObservableProperty, NotifyPropertyChangedFor(nameof(IsProgressVisible))]
|
||
1 year ago
|
private double value;
|
||
1 year ago
|
|
||
|
[ObservableProperty]
|
||
|
private double maximum = 100;
|
||
1 year ago
|
|
||
1 year ago
|
[ObservableProperty, NotifyPropertyChangedFor(nameof(IsProgressVisible))]
|
||
1 year ago
|
private bool isIndeterminate;
|
||
|
|
||
1 year ago
|
public virtual bool IsProgressVisible => Value > 0 || IsIndeterminate;
|
||
1 year ago
|
public virtual bool IsTextVisible => !string.IsNullOrWhiteSpace(Text);
|
||
1 year ago
|
}
|