@@ -4,69 +4,70 @@ using CommunityToolkit.Mvvm.Messaging;
|
||||
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
|
||||
namespace Wino.Mail.ViewModels;
|
||||
|
||||
public partial class ReadComposePanePageViewModel : MailBaseViewModel,
|
||||
IRecipient<PropertyChangedMessage<string>>,
|
||||
IRecipient<PropertyChangedMessage<int>>
|
||||
namespace Wino.Mail.ViewModels
|
||||
{
|
||||
private readonly IFontService _fontService;
|
||||
|
||||
public IPreferencesService PreferencesService { get; set; }
|
||||
public List<string> AvailableFonts => _fontService.GetFonts();
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedRecipients]
|
||||
string currentReaderFont;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedRecipients]
|
||||
int currentReaderFontSize;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedRecipients]
|
||||
string currentComposerFont;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedRecipients]
|
||||
int currentComposerFontSize;
|
||||
|
||||
public ReadComposePanePageViewModel(IMailDialogService dialogService,
|
||||
IFontService fontService,
|
||||
IPreferencesService preferencesService)
|
||||
public partial class ReadComposePanePageViewModel : MailBaseViewModel,
|
||||
IRecipient<PropertyChangedMessage<string>>,
|
||||
IRecipient<PropertyChangedMessage<int>>
|
||||
{
|
||||
_fontService = fontService;
|
||||
PreferencesService = preferencesService;
|
||||
private readonly IFontService _fontService;
|
||||
|
||||
CurrentReaderFont = preferencesService.ReaderFont;
|
||||
CurrentReaderFontSize = preferencesService.ReaderFontSize;
|
||||
public IPreferencesService PreferencesService { get; set; }
|
||||
public List<string> AvailableFonts => _fontService.GetFonts();
|
||||
|
||||
CurrentComposerFont = preferencesService.ComposerFont;
|
||||
CurrentComposerFontSize = preferencesService.ComposerFontSize;
|
||||
}
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedRecipients]
|
||||
string currentReaderFont;
|
||||
|
||||
public void Receive(PropertyChangedMessage<string> message)
|
||||
{
|
||||
if (message.PropertyName == nameof(CurrentReaderFont) && message.OldValue != message.NewValue)
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedRecipients]
|
||||
int currentReaderFontSize;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedRecipients]
|
||||
string currentComposerFont;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedRecipients]
|
||||
int currentComposerFontSize;
|
||||
|
||||
public ReadComposePanePageViewModel(IMailDialogService dialogService,
|
||||
IFontService fontService,
|
||||
IPreferencesService preferencesService)
|
||||
{
|
||||
PreferencesService.ReaderFont = message.NewValue;
|
||||
_fontService = fontService;
|
||||
PreferencesService = preferencesService;
|
||||
|
||||
CurrentReaderFont = preferencesService.ReaderFont;
|
||||
CurrentReaderFontSize = preferencesService.ReaderFontSize;
|
||||
|
||||
CurrentComposerFont = preferencesService.ComposerFont;
|
||||
CurrentComposerFontSize = preferencesService.ComposerFontSize;
|
||||
}
|
||||
|
||||
if (message.PropertyName == nameof(CurrentComposerFont) && message.OldValue != message.NewValue)
|
||||
public void Receive(PropertyChangedMessage<string> message)
|
||||
{
|
||||
PreferencesService.ComposerFont = message.NewValue;
|
||||
}
|
||||
}
|
||||
if (message.PropertyName == nameof(CurrentReaderFont) && message.OldValue != message.NewValue)
|
||||
{
|
||||
PreferencesService.ReaderFont = message.NewValue;
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<int> message)
|
||||
{
|
||||
if (message.PropertyName == nameof(CurrentReaderFontSize))
|
||||
{
|
||||
PreferencesService.ReaderFontSize = CurrentReaderFontSize;
|
||||
if (message.PropertyName == nameof(CurrentComposerFont) && message.OldValue != message.NewValue)
|
||||
{
|
||||
PreferencesService.ComposerFont = message.NewValue;
|
||||
}
|
||||
}
|
||||
else if (message.PropertyName == nameof(CurrentComposerFontSize))
|
||||
|
||||
public void Receive(PropertyChangedMessage<int> message)
|
||||
{
|
||||
PreferencesService.ComposerFontSize = CurrentComposerFontSize;
|
||||
if (message.PropertyName == nameof(CurrentReaderFontSize))
|
||||
{
|
||||
PreferencesService.ReaderFontSize = CurrentReaderFontSize;
|
||||
}
|
||||
else if (message.PropertyName == nameof(CurrentComposerFontSize))
|
||||
{
|
||||
PreferencesService.ComposerFontSize = CurrentComposerFontSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user