d85f2e0fb3
Bootstraper läd jetzt die farbeinstellung sofort und nicht nachträglich cleanup and rework PDF switch to HTML export fix Colorsystem Farben für knöpfe hinzugefügt als anpassung button color button color primary and secondary change
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using Microsoft.Maui.Graphics;
|
|
|
|
namespace cfs_tracker.ViewModels;
|
|
|
|
public partial class DayEntryItemViewModel : ObservableObject
|
|
{
|
|
public int Id { get; init; }
|
|
public DateTime Date { get; init; }
|
|
public string SlotText { get; init; } = string.Empty;
|
|
public string StateText { get; init; } = string.Empty;
|
|
public string ActivityText { get; init; } = string.Empty;
|
|
public string SymptomsText { get; init; } = string.Empty;
|
|
public bool IsBackfill { get; init; }
|
|
public Color StateColor { get; init; } = Colors.Transparent;
|
|
public Color ForegroundColor { get; init; } = Colors.White;
|
|
|
|
public bool HasActivity => !string.IsNullOrWhiteSpace(ActivityText);
|
|
public bool HasSymptoms => !string.IsNullOrWhiteSpace(SymptomsText);
|
|
public bool HasDetails => HasActivity || HasSymptoms;
|
|
public string DetailsButtonText => IsExpanded ? "Details ausblenden" : "Details anzeigen";
|
|
|
|
[ObservableProperty]
|
|
private bool isExpanded;
|
|
|
|
public IRelayCommand ToggleExpandedCommand { get; }
|
|
|
|
public DayEntryItemViewModel()
|
|
{
|
|
ToggleExpandedCommand = new RelayCommand(ToggleExpanded);
|
|
}
|
|
|
|
partial void OnIsExpandedChanged(bool value)
|
|
{
|
|
OnPropertyChanged(nameof(DetailsButtonText));
|
|
}
|
|
|
|
private void ToggleExpanded()
|
|
{
|
|
if (!HasDetails)
|
|
return;
|
|
|
|
IsExpanded = !IsExpanded;
|
|
}
|
|
}
|