@@ -4,103 +4,104 @@ using Wino.Core.Domain;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
|
||||
namespace Wino.Mail.ViewModels;
|
||||
|
||||
public class MessageListPageViewModel : MailBaseViewModel
|
||||
namespace Wino.Mail.ViewModels
|
||||
{
|
||||
public IPreferencesService PreferencesService { get; }
|
||||
|
||||
private int selectedMarkAsOptionIndex;
|
||||
|
||||
public int SelectedMarkAsOptionIndex
|
||||
public class MessageListPageViewModel : MailBaseViewModel
|
||||
{
|
||||
get => selectedMarkAsOptionIndex;
|
||||
set
|
||||
public IPreferencesService PreferencesService { get; }
|
||||
|
||||
private int selectedMarkAsOptionIndex;
|
||||
|
||||
public int SelectedMarkAsOptionIndex
|
||||
{
|
||||
if (SetProperty(ref selectedMarkAsOptionIndex, value))
|
||||
get => selectedMarkAsOptionIndex;
|
||||
set
|
||||
{
|
||||
if (value >= 0)
|
||||
if (SetProperty(ref selectedMarkAsOptionIndex, value))
|
||||
{
|
||||
PreferencesService.MarkAsPreference = (MailMarkAsOption)Enum.GetValues<MailMarkAsOption>().GetValue(value);
|
||||
if (value >= 0)
|
||||
{
|
||||
PreferencesService.MarkAsPreference = (MailMarkAsOption)Enum.GetValues<MailMarkAsOption>().GetValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private readonly List<MailOperation> availableHoverActions =
|
||||
[
|
||||
MailOperation.Archive,
|
||||
MailOperation.SoftDelete,
|
||||
MailOperation.SetFlag,
|
||||
MailOperation.MarkAsRead,
|
||||
MailOperation.MoveToJunk
|
||||
];
|
||||
private readonly List<MailOperation> availableHoverActions =
|
||||
[
|
||||
MailOperation.Archive,
|
||||
MailOperation.SoftDelete,
|
||||
MailOperation.SetFlag,
|
||||
MailOperation.MarkAsRead,
|
||||
MailOperation.MoveToJunk
|
||||
];
|
||||
|
||||
public List<string> AvailableHoverActionsTranslations { get; set; } =
|
||||
[
|
||||
Translator.HoverActionOption_Archive,
|
||||
Translator.HoverActionOption_Delete,
|
||||
Translator.HoverActionOption_ToggleFlag,
|
||||
Translator.HoverActionOption_ToggleRead,
|
||||
Translator.HoverActionOption_MoveJunk
|
||||
];
|
||||
public List<string> AvailableHoverActionsTranslations { get; set; } =
|
||||
[
|
||||
Translator.HoverActionOption_Archive,
|
||||
Translator.HoverActionOption_Delete,
|
||||
Translator.HoverActionOption_ToggleFlag,
|
||||
Translator.HoverActionOption_ToggleRead,
|
||||
Translator.HoverActionOption_MoveJunk
|
||||
];
|
||||
|
||||
#region Properties
|
||||
#region Properties
|
||||
|
||||
private int leftHoverActionIndex;
|
||||
private int leftHoverActionIndex;
|
||||
|
||||
public int LeftHoverActionIndex
|
||||
{
|
||||
get => leftHoverActionIndex;
|
||||
set
|
||||
public int LeftHoverActionIndex
|
||||
{
|
||||
if (SetProperty(ref leftHoverActionIndex, value))
|
||||
get => leftHoverActionIndex;
|
||||
set
|
||||
{
|
||||
PreferencesService.LeftHoverAction = availableHoverActions[value];
|
||||
if (SetProperty(ref leftHoverActionIndex, value))
|
||||
{
|
||||
PreferencesService.LeftHoverAction = availableHoverActions[value];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int centerHoverActionIndex;
|
||||
private int centerHoverActionIndex;
|
||||
|
||||
public int CenterHoverActionIndex
|
||||
{
|
||||
get => centerHoverActionIndex;
|
||||
set
|
||||
public int CenterHoverActionIndex
|
||||
{
|
||||
if (SetProperty(ref centerHoverActionIndex, value))
|
||||
get => centerHoverActionIndex;
|
||||
set
|
||||
{
|
||||
PreferencesService.CenterHoverAction = availableHoverActions[value];
|
||||
if (SetProperty(ref centerHoverActionIndex, value))
|
||||
{
|
||||
PreferencesService.CenterHoverAction = availableHoverActions[value];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int rightHoverActionIndex;
|
||||
private int rightHoverActionIndex;
|
||||
|
||||
public int RightHoverActionIndex
|
||||
{
|
||||
get => rightHoverActionIndex;
|
||||
set
|
||||
public int RightHoverActionIndex
|
||||
{
|
||||
if (SetProperty(ref rightHoverActionIndex, value))
|
||||
get => rightHoverActionIndex;
|
||||
set
|
||||
{
|
||||
PreferencesService.RightHoverAction = availableHoverActions[value];
|
||||
if (SetProperty(ref rightHoverActionIndex, value))
|
||||
{
|
||||
PreferencesService.RightHoverAction = availableHoverActions[value];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public MessageListPageViewModel(IMailDialogService dialogService,
|
||||
IPreferencesService preferencesService)
|
||||
{
|
||||
PreferencesService = preferencesService;
|
||||
public MessageListPageViewModel(IMailDialogService dialogService,
|
||||
IPreferencesService preferencesService)
|
||||
{
|
||||
PreferencesService = preferencesService;
|
||||
|
||||
leftHoverActionIndex = availableHoverActions.IndexOf(PreferencesService.LeftHoverAction);
|
||||
centerHoverActionIndex = availableHoverActions.IndexOf(PreferencesService.CenterHoverAction);
|
||||
rightHoverActionIndex = availableHoverActions.IndexOf(PreferencesService.RightHoverAction);
|
||||
leftHoverActionIndex = availableHoverActions.IndexOf(PreferencesService.LeftHoverAction);
|
||||
centerHoverActionIndex = availableHoverActions.IndexOf(PreferencesService.CenterHoverAction);
|
||||
rightHoverActionIndex = availableHoverActions.IndexOf(PreferencesService.RightHoverAction);
|
||||
|
||||
SelectedMarkAsOptionIndex = Array.IndexOf(Enum.GetValues<MailMarkAsOption>(), PreferencesService.MarkAsPreference);
|
||||
SelectedMarkAsOptionIndex = Array.IndexOf(Enum.GetValues<MailMarkAsOption>(), PreferencesService.MarkAsPreference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user