Files
ConeCalorimeter/ConeCalorimeter/ViewModels/DeviceActionViewModel.cs
GukSang.Jin dcf50ea870 更新
2026-05-27 09:28:48 +08:00

52 lines
1.1 KiB
C#

using System.Windows.Input;
using CommunityToolkit.Mvvm.ComponentModel;
namespace ConeCalorimeter.ViewModels;
public sealed class DeviceActionViewModel : ObservableObject
{
private string _displayText;
private bool _isActive;
private bool _isStatusKnown = true;
public DeviceActionViewModel(string label, ICommand command)
{
Label = label;
Command = command;
_displayText = label;
}
public string Label { get; }
public string DisplayText
{
get => _displayText;
private set => SetProperty(ref _displayText, value);
}
public ICommand Command { get; }
public bool IsActive
{
get => _isActive;
private set => SetProperty(ref _isActive, value);
}
public bool IsStatusKnown
{
get => _isStatusKnown;
private set => SetProperty(ref _isStatusKnown, value);
}
public void SetDisplayText(string displayText)
{
DisplayText = displayText;
}
public void UpdateStatus(bool isActive, bool isStatusKnown = true)
{
IsStatusKnown = isStatusKnown;
IsActive = isActive;
}
}