95 lines
2.9 KiB
C#
95 lines
2.9 KiB
C#
using WPFluent.Gallery.ControlsLookup;
|
|
using WPFluent.Gallery.Models;
|
|
using WPFluent.Gallery.Views.Pages;
|
|
|
|
namespace WPFluent.Gallery.ViewModels.Pages;
|
|
|
|
public partial class StatusAndInfoViewModel : ViewModel
|
|
{
|
|
[ObservableProperty]
|
|
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard>(
|
|
ControlPages
|
|
.FromNamespace(typeof(StatusAndInfoPage).Namespace!)
|
|
.Select(x => new NavigationCard()
|
|
{
|
|
Name = x.Name,
|
|
Icon = x.Icon,
|
|
Description = x.Description,
|
|
PageType = x.PageType,
|
|
})
|
|
);
|
|
[ObservableProperty]
|
|
private InfoBadgeSeverity _infoBadgeSeverity = InfoBadgeSeverity.Attention;
|
|
|
|
private int _infoBadgeSeverityComboBoxSelectedIndex = 0;
|
|
|
|
public int InfoBadgeSeverityComboBoxSelectedIndex
|
|
{
|
|
get => _infoBadgeSeverityComboBoxSelectedIndex;
|
|
set
|
|
{
|
|
_ = SetProperty(ref _infoBadgeSeverityComboBoxSelectedIndex, value);
|
|
InfoBadgeSeverity = ConvertIndexToInfoBadgeSeverity(value);
|
|
}
|
|
}
|
|
[ObservableProperty]
|
|
private bool _isShortInfoBarOpened = true;
|
|
|
|
[ObservableProperty]
|
|
private bool _isLongInfoBarOpened = true;
|
|
|
|
[ObservableProperty]
|
|
private InfoBarSeverity _shortInfoBarSeverity = InfoBarSeverity.Informational;
|
|
|
|
[ObservableProperty]
|
|
private InfoBarSeverity _longInfoBarSeverity = InfoBarSeverity.Informational;
|
|
|
|
private int _shortInfoBarSeverityComboBoxSelectedIndex = 0;
|
|
|
|
public int ShortInfoBarSeverityComboBoxSelectedIndex
|
|
{
|
|
get => _shortInfoBarSeverityComboBoxSelectedIndex;
|
|
set
|
|
{
|
|
_ = SetProperty(ref _shortInfoBarSeverityComboBoxSelectedIndex, value);
|
|
|
|
ShortInfoBarSeverity = ConvertIndexToInfoBarSeverity(value);
|
|
}
|
|
}
|
|
|
|
private int _longInfoBarSeverityComboBoxSelectedIndex = 0;
|
|
|
|
public int LongInfoBarSeverityComboBoxSelectedIndex
|
|
{
|
|
get => _longInfoBarSeverityComboBoxSelectedIndex;
|
|
set
|
|
{
|
|
_ = SetProperty(ref _longInfoBarSeverityComboBoxSelectedIndex, value);
|
|
|
|
LongInfoBarSeverity = ConvertIndexToInfoBarSeverity(value);
|
|
}
|
|
}
|
|
|
|
private static InfoBarSeverity ConvertIndexToInfoBarSeverity(int value)
|
|
{
|
|
return value switch
|
|
{
|
|
1 => InfoBarSeverity.Success,
|
|
2 => InfoBarSeverity.Warning,
|
|
3 => InfoBarSeverity.Error,
|
|
_ => InfoBarSeverity.Informational,
|
|
};
|
|
}
|
|
private static InfoBadgeSeverity ConvertIndexToInfoBadgeSeverity(int value)
|
|
{
|
|
return value switch
|
|
{
|
|
1 => InfoBadgeSeverity.Informational,
|
|
2 => InfoBadgeSeverity.Success,
|
|
3 => InfoBadgeSeverity.Caution,
|
|
4 => InfoBadgeSeverity.Critical,
|
|
_ => InfoBadgeSeverity.Attention,
|
|
};
|
|
}
|
|
}
|