更新整理
This commit is contained in:
94
WPFluent.Gallery/ViewModels/Pages/StatusAndInfoViewModel.cs
Normal file
94
WPFluent.Gallery/ViewModels/Pages/StatusAndInfoViewModel.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user