Ground work for Wino Calendar. (#475)

Wino Calendar abstractions.
This commit is contained in:
Burak Kaan Köse
2024-11-10 23:28:25 +01:00
committed by GitHub
parent a979e8430f
commit d1d6f12f05
486 changed files with 7969 additions and 2708 deletions

View File

@@ -0,0 +1,111 @@
using System;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Input;
using Wino.Core.Domain;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
namespace Wino.Core.ViewModels
{
public partial class AboutPageViewModel : CoreBaseViewModel
{
private readonly IStoreRatingService _storeRatingService;
private readonly IMailDialogService _dialogService;
private readonly INativeAppService _nativeAppService;
private readonly IApplicationConfiguration _appInitializerService;
private readonly IFileService _fileService;
private readonly ILogInitializer _logInitializer;
public string VersionName => _nativeAppService.GetFullAppVersion();
public string DiscordChannelUrl => "https://discord.gg/windows-apps-hub-714581497222398064";
public string GitHubUrl => "https://github.com/bkaankose/Wino-Mail/";
public string PrivacyPolicyUrl => "https://www.winomail.app/privacy_policy.html";
public string PaypalUrl => "https://paypal.me/bkaankose?country.x=PL&locale.x=en_US";
public IPreferencesService PreferencesService { get; }
public AboutPageViewModel(IStoreRatingService storeRatingService,
IMailDialogService dialogService,
INativeAppService nativeAppService,
IPreferencesService preferencesService,
IApplicationConfiguration appInitializerService,
IFileService fileService,
ILogInitializer logInitializer)
{
_storeRatingService = storeRatingService;
_dialogService = dialogService;
_nativeAppService = nativeAppService;
_logInitializer = logInitializer;
_appInitializerService = appInitializerService;
_fileService = fileService;
PreferencesService = preferencesService;
}
protected override void OnActivated()
{
base.OnActivated();
PreferencesService.PreferenceChanged -= PreferencesChanged;
PreferencesService.PreferenceChanged += PreferencesChanged;
}
protected override void OnDeactivated()
{
base.OnDeactivated();
PreferencesService.PreferenceChanged -= PreferencesChanged;
}
private void PreferencesChanged(object sender, string e)
{
if (e == nameof(PreferencesService.IsLoggingEnabled))
{
_logInitializer.RefreshLoggingLevel();
}
}
[RelayCommand]
private async Task ShareWinoLogAsync()
{
var appDataFolder = _appInitializerService.ApplicationDataFolderPath;
var selectedFolderPath = await _dialogService.PickWindowsFolderAsync();
if (string.IsNullOrEmpty(selectedFolderPath)) return;
var areLogsSaved = await _fileService.SaveLogsToFolderAsync(appDataFolder, selectedFolderPath).ConfigureAwait(false);
if (areLogsSaved)
{
_dialogService.InfoBarMessage(Translator.Info_LogsSavedTitle, string.Format(Translator.Info_LogsSavedMessage, Constants.LogArchiveFileName), InfoBarMessageType.Success);
}
else
{
_dialogService.InfoBarMessage(Translator.Info_LogsNotFoundTitle, Translator.Info_LogsNotFoundMessage, InfoBarMessageType.Error);
}
}
[RelayCommand]
private async Task Navigate(object url)
{
if (url is string stringUrl)
{
if (stringUrl == "Store")
await ShowRateDialogAsync();
else
{
// Discord disclaimer message about server.
if (stringUrl == DiscordChannelUrl)
await _dialogService.ShowMessageAsync(Translator.DiscordChannelDisclaimerMessage,
Translator.DiscordChannelDisclaimerTitle,
WinoCustomMessageDialogIcon.Warning);
await _nativeAppService.LaunchUriAsync(new Uri(stringUrl));
}
}
}
private Task ShowRateDialogAsync() => _storeRatingService.LaunchStorePageForReviewAsync();
}
}

View File

@@ -0,0 +1,124 @@
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Wino.Core.Domain;
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Store;
using Wino.Mail.ViewModels.Data;
using Wino.Messaging.Client.Authorization;
using Wino.Messaging.Client.Navigation;
namespace Wino.Core.ViewModels
{
public abstract partial class AccountManagementPageViewModelBase : CoreBaseViewModel, IRecipient<ProtocolAuthorizationCallbackReceived>
{
public ObservableCollection<IAccountProviderDetailViewModel> Accounts { get; set; } = [];
public bool IsPurchasePanelVisible => !HasUnlimitedAccountProduct;
public bool IsAccountCreationAlmostOnLimit => Accounts != null && Accounts.Count == FREE_ACCOUNT_COUNT - 1;
public bool HasAccountsDefined => Accounts != null && Accounts.Any();
public bool CanReorderAccounts => Accounts?.Sum(a => a.HoldingAccountCount) > 1;
public string UsedAccountsString => string.Format(Translator.WinoUpgradeRemainingAccountsMessage, Accounts.Count, FREE_ACCOUNT_COUNT);
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsPurchasePanelVisible))]
private bool hasUnlimitedAccountProduct;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsAccountCreationAlmostOnLimit))]
[NotifyPropertyChangedFor(nameof(IsPurchasePanelVisible))]
private bool isAccountCreationBlocked;
[ObservableProperty]
private IAccountProviderDetailViewModel _startupAccount;
public int FREE_ACCOUNT_COUNT { get; } = 3;
protected IDialogServiceBase DialogService { get; }
protected IWinoServerConnectionManager WinoServerConnectionManager { get; }
protected INavigationService NavigationService { get; }
protected IAccountService AccountService { get; }
protected IProviderService ProviderService { get; }
protected IStoreManagementService StoreManagementService { get; }
protected IAuthenticationProvider AuthenticationProvider { get; }
protected IPreferencesService PreferencesService { get; }
public AccountManagementPageViewModelBase(IDialogServiceBase dialogService,
IWinoServerConnectionManager winoServerConnectionManager,
INavigationService navigationService,
IAccountService accountService,
IProviderService providerService,
IStoreManagementService storeManagementService,
IAuthenticationProvider authenticationProvider,
IPreferencesService preferencesService)
{
DialogService = dialogService;
WinoServerConnectionManager = winoServerConnectionManager;
NavigationService = navigationService;
AccountService = accountService;
ProviderService = providerService;
StoreManagementService = storeManagementService;
AuthenticationProvider = authenticationProvider;
PreferencesService = preferencesService;
}
[RelayCommand]
private void NavigateAccountDetails(AccountProviderDetailViewModel accountDetails)
{
Messenger.Send(new BreadcrumbNavigationRequested(accountDetails.Account.Name,
WinoPage.AccountDetailsPage,
accountDetails.Account.Id));
}
[RelayCommand]
public async Task PurchaseUnlimitedAccountAsync()
{
var purchaseResult = await StoreManagementService.PurchaseAsync(StoreProductType.UnlimitedAccounts);
if (purchaseResult == StorePurchaseResult.Succeeded)
DialogService.InfoBarMessage(Translator.Info_PurchaseThankYouTitle, Translator.Info_PurchaseThankYouMessage, InfoBarMessageType.Success);
else if (purchaseResult == StorePurchaseResult.AlreadyPurchased)
DialogService.InfoBarMessage(Translator.Info_PurchaseExistsTitle, Translator.Info_PurchaseExistsMessage, InfoBarMessageType.Warning);
bool shouldRefreshPurchasePanel = purchaseResult == StorePurchaseResult.Succeeded || purchaseResult == StorePurchaseResult.AlreadyPurchased;
if (shouldRefreshPurchasePanel)
{
await ManageStorePurchasesAsync();
}
}
public async void Receive(ProtocolAuthorizationCallbackReceived message)
{
// Authorization must be completed in the server.
await WinoServerConnectionManager.GetResponseAsync<bool, ProtocolAuthorizationCallbackReceived>(message);
}
public async Task ManageStorePurchasesAsync()
{
await ExecuteUIThread(async () =>
{
HasUnlimitedAccountProduct = await StoreManagementService.HasProductAsync(StoreProductType.UnlimitedAccounts);
if (!HasUnlimitedAccountProduct)
IsAccountCreationBlocked = Accounts.Count >= FREE_ACCOUNT_COUNT;
else
IsAccountCreationBlocked = false;
});
}
public AccountProviderDetailViewModel GetAccountProviderDetails(MailAccount account)
{
var provider = ProviderService.GetProviderDetail(account.ProviderType);
return new AccountProviderDetailViewModel(provider, account);
}
public abstract Task InitializeAccountsAsync();
}
}

View File

@@ -0,0 +1,13 @@
using CommunityToolkit.Mvvm.Messaging;
using Wino.Core.Domain.Interfaces;
using Wino.Messaging.Client.Calendar;
namespace Wino.Core.ViewModels
{
public class CalendarBaseViewModel : CoreBaseViewModel, IRecipient<CalendarEventAdded>
{
public void Receive(CalendarEventAdded message) => OnCalendarEventAdded(message.CalendarItem);
protected virtual void OnCalendarEventAdded(ICalendarItem calendarItem) { }
}
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Navigation;
using Wino.Messaging.UI;
namespace Wino.Core.ViewModels
{
public class CoreBaseViewModel : ObservableRecipient,
INavigationAware,
IRecipient<AccountCreatedMessage>,
IRecipient<AccountRemovedMessage>,
IRecipient<AccountUpdatedMessage>
{
private IDispatcher _dispatcher;
public IDispatcher Dispatcher
{
get
{
return _dispatcher;
}
set
{
_dispatcher = value;
if (value != null)
{
OnDispatcherAssigned();
}
}
}
public virtual void OnNavigatedTo(NavigationMode mode, object parameters) { IsActive = true; }
public virtual void OnNavigatedFrom(NavigationMode mode, object parameters) { IsActive = false; }
public virtual void OnPageLoaded() { }
public async Task ExecuteUIThread(Action action) => await Dispatcher?.ExecuteOnUIThread(action);
public void ReportUIChange<TMessage>(TMessage message) where TMessage : class, IUIMessage => Messenger.Send(message);
protected virtual void OnDispatcherAssigned() { }
protected virtual void OnAccountCreated(MailAccount createdAccount) { }
protected virtual void OnAccountRemoved(MailAccount removedAccount) { }
protected virtual void OnAccountUpdated(MailAccount updatedAccount) { }
void IRecipient<AccountCreatedMessage>.Receive(AccountCreatedMessage message) => OnAccountCreated(message.Account);
void IRecipient<AccountRemovedMessage>.Receive(AccountRemovedMessage message) => OnAccountRemoved(message.Account);
void IRecipient<AccountUpdatedMessage>.Receive(AccountUpdatedMessage message) => OnAccountUpdated(message.Account);
}
}

View File

@@ -0,0 +1,34 @@
using System;
using CommunityToolkit.Mvvm.ComponentModel;
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Interfaces;
namespace Wino.Mail.ViewModels.Data
{
public partial class AccountProviderDetailViewModel : ObservableObject, IAccountProviderDetailViewModel
{
[ObservableProperty]
private MailAccount account;
public IProviderDetail ProviderDetail { get; set; }
public Guid StartupEntityId => Account.Id;
public string StartupEntityTitle => Account.Name;
public int Order => Account.Order;
public string StartupEntityAddresses => Account.Address;
public int HoldingAccountCount => 1;
public bool HasProfilePicture => !string.IsNullOrEmpty(Account.Base64ProfilePictureData);
public AccountProviderDetailViewModel(IProviderDetail providerDetail, MailAccount account)
{
ProviderDetail = providerDetail;
Account = account;
}
}
}

View File

@@ -0,0 +1,23 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace Wino.Core.ViewModels.Data
{
public class AppColorViewModel : ObservableObject
{
private string _hex;
public string Hex
{
get => _hex;
set => SetProperty(ref _hex, value);
}
public bool IsAccentColor { get; }
public AppColorViewModel(string hex, bool isAccentColor = false)
{
IsAccentColor = isAccentColor;
Hex = hex;
}
}
}

View File

@@ -0,0 +1,23 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Wino.Messaging.Client.Navigation;
namespace Wino.Mail.ViewModels.Data
{
public partial class BreadcrumbNavigationItemViewModel : ObservableObject
{
[ObservableProperty]
private string title;
[ObservableProperty]
private bool isActive;
public BreadcrumbNavigationRequested Request { get; set; }
public BreadcrumbNavigationItemViewModel(BreadcrumbNavigationRequested request, bool isActive)
{
Request = request;
Title = request.PageTitle;
IsActive = isActive;
}
}
}

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CommunityToolkit.Mvvm.ComponentModel;
using Wino.Core.Domain.Entities.Mail;
using Wino.Core.Domain.Interfaces;
using Wino.Mail.ViewModels.Data;
namespace Wino.Core.ViewModels.Data
{
public partial class MergedAccountProviderDetailViewModel : ObservableObject, IAccountProviderDetailViewModel
{
public List<AccountProviderDetailViewModel> HoldingAccounts { get; }
public MergedInbox MergedInbox { get; }
public string AccountAddresses => string.Join(", ", HoldingAccounts.Select(a => a.Account.Address));
public Guid StartupEntityId => MergedInbox.Id;
public string StartupEntityTitle => MergedInbox.Name;
public int Order => 0;
public IProviderDetail ProviderDetail { get; set; }
public string StartupEntityAddresses => AccountAddresses;
public int HoldingAccountCount => HoldingAccounts.Count;
public MergedAccountProviderDetailViewModel(MergedInbox mergedInbox, List<AccountProviderDetailViewModel> holdingAccounts)
{
MergedInbox = mergedInbox;
HoldingAccounts = holdingAccounts;
}
}
}

View File

@@ -0,0 +1,11 @@
using Wino.Core.Domain.Interfaces;
namespace Wino.Core.ViewModels
{
public class NewAccountManagementPageViewModel : CoreBaseViewModel
{
public NewAccountManagementPageViewModel(IMailDialogService dialogService)
{
}
}
}

View File

@@ -0,0 +1,291 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Wino.Core.Domain;
using Wino.Core.Domain.Entities.Mail;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Personalization;
using Wino.Core.ViewModels.Data;
namespace Wino.Core.ViewModels
{
public partial class PersonalizationPageViewModel : CoreBaseViewModel
{
public IStatePersistanceService StatePersistenceService { get; }
public IPreferencesService PreferencesService { get; }
private readonly IMailDialogService _dialogService;
private readonly IThemeService _themeService;
private bool isPropChangeDisabled = false;
// Sample mail copy to use in previewing mail display modes.
public MailCopy DemoPreviewMailCopy { get; } = new MailCopy()
{
FromName = "Sender Name",
Subject = "Mail Subject",
PreviewText = "Thank you for using Wino Mail. We hope you enjoy the experience.",
};
#region Personalization
public bool IsSelectedWindowsAccentColor => SelectedAppColor == Colors.LastOrDefault();
public ObservableCollection<AppColorViewModel> Colors { get; set; } = [];
public List<ElementThemeContainer> ElementThemes { get; set; } =
[
new ElementThemeContainer(ApplicationElementTheme.Light, Translator.ElementTheme_Light),
new ElementThemeContainer(ApplicationElementTheme.Dark, Translator.ElementTheme_Dark),
new ElementThemeContainer(ApplicationElementTheme.Default, Translator.ElementTheme_Default),
];
public List<MailListDisplayMode> InformationDisplayModes { get; set; } =
[
MailListDisplayMode.Compact,
MailListDisplayMode.Medium,
MailListDisplayMode.Spacious
];
public List<AppThemeBase> AppThemes { get; set; }
[ObservableProperty]
private ElementThemeContainer selectedElementTheme;
[ObservableProperty]
private MailListDisplayMode selectedInfoDisplayMode;
private AppColorViewModel _selectedAppColor;
public AppColorViewModel SelectedAppColor
{
get => _selectedAppColor;
set
{
if (SetProperty(ref _selectedAppColor, value))
{
UseAccentColor = value == Colors?.LastOrDefault();
}
}
}
private bool _useAccentColor;
public bool UseAccentColor
{
get => _useAccentColor;
set
{
if (SetProperty(ref _useAccentColor, value))
{
if (value)
{
SelectedAppColor = Colors?.LastOrDefault();
}
else if (SelectedAppColor == Colors?.LastOrDefault())
{
// Unchecking from accent color.
SelectedAppColor = Colors?.FirstOrDefault();
}
}
}
}
// Allow app theme change for system themes.
public bool CanSelectElementTheme => SelectedAppTheme != null &&
(SelectedAppTheme.AppThemeType == AppThemeType.System || SelectedAppTheme.AppThemeType == AppThemeType.Custom);
private AppThemeBase _selectedAppTheme;
public AppThemeBase SelectedAppTheme
{
get => _selectedAppTheme;
set
{
if (SetProperty(ref _selectedAppTheme, value))
{
OnPropertyChanged(nameof(CanSelectElementTheme));
if (!CanSelectElementTheme)
{
SelectedElementTheme = null;
}
}
}
}
#endregion
[RelayCommand]
private void ResetMailListPaneLength()
{
StatePersistenceService.MailListPaneLength = 420;
_dialogService.InfoBarMessage(Translator.GeneralTitle_Info, Translator.Info_MailListSizeResetSuccessMessage, InfoBarMessageType.Success);
}
public AsyncRelayCommand CreateCustomThemeCommand { get; set; }
public PersonalizationPageViewModel(IMailDialogService dialogService,
IStatePersistanceService statePersistanceService,
IThemeService themeService,
IPreferencesService preferencesService)
{
CreateCustomThemeCommand = new AsyncRelayCommand(CreateCustomThemeAsync);
_dialogService = dialogService;
StatePersistenceService = statePersistanceService;
_themeService = themeService;
PreferencesService = preferencesService;
}
private async Task CreateCustomThemeAsync()
{
bool isThemeCreated = await _dialogService.ShowCustomThemeBuilderDialogAsync();
if (isThemeCreated)
{
// Reload themes.
await InitializeSettingsAsync();
}
}
private void InitializeColors()
{
Colors.Add(new AppColorViewModel("#0078d7"));
Colors.Add(new AppColorViewModel("#00838c"));
Colors.Add(new AppColorViewModel("#e3008c"));
Colors.Add(new AppColorViewModel("#ca4f07"));
Colors.Add(new AppColorViewModel("#e81123"));
Colors.Add(new AppColorViewModel("#00819e"));
Colors.Add(new AppColorViewModel("#10893e"));
Colors.Add(new AppColorViewModel("#881798"));
Colors.Add(new AppColorViewModel("#c239b3"));
Colors.Add(new AppColorViewModel("#767676"));
Colors.Add(new AppColorViewModel("#e1b12c"));
Colors.Add(new AppColorViewModel("#16a085"));
Colors.Add(new AppColorViewModel("#0984e3"));
Colors.Add(new AppColorViewModel("#4a69bd"));
Colors.Add(new AppColorViewModel("#05c46b"));
// Add system accent color as last item.
Colors.Add(new AppColorViewModel(_themeService.GetSystemAccentColorHex(), true));
}
/// <summary>
/// Set selections from settings service.
/// </summary>
private void SetInitialValues()
{
SelectedElementTheme = ElementThemes.Find(a => a.NativeTheme == _themeService.RootTheme);
SelectedInfoDisplayMode = PreferencesService.MailItemDisplayMode;
var currentAccentColor = _themeService.AccentColor;
bool isWindowsColor = string.IsNullOrEmpty(currentAccentColor);
if (isWindowsColor)
{
SelectedAppColor = Colors.LastOrDefault();
UseAccentColor = true;
}
else
SelectedAppColor = Colors.FirstOrDefault(a => a.Hex == currentAccentColor);
SelectedAppTheme = AppThemes.Find(a => a.Id == _themeService.CurrentApplicationThemeId);
}
protected override async void OnActivated()
{
base.OnActivated();
await InitializeSettingsAsync();
}
private async Task InitializeSettingsAsync()
{
Deactivate();
AppThemes = await _themeService.GetAvailableThemesAsync();
OnPropertyChanged(nameof(AppThemes));
InitializeColors();
SetInitialValues();
PropertyChanged -= PersonalizationSettingsUpdated;
PropertyChanged += PersonalizationSettingsUpdated;
_themeService.AccentColorChanged -= AccentColorChanged;
_themeService.ElementThemeChanged -= ElementThemeChanged;
_themeService.AccentColorChanged += AccentColorChanged;
_themeService.ElementThemeChanged += ElementThemeChanged;
}
private void AccentColorChanged(object sender, string e)
{
isPropChangeDisabled = true;
SelectedAppColor = Colors.FirstOrDefault(a => a.Hex == e);
isPropChangeDisabled = false;
}
private void ElementThemeChanged(object sender, ApplicationElementTheme e)
{
isPropChangeDisabled = true;
SelectedElementTheme = ElementThemes.Find(a => a.NativeTheme == e);
isPropChangeDisabled = false;
}
protected override void OnDeactivated()
{
base.OnDeactivated();
Deactivate();
}
private void Deactivate()
{
PropertyChanged -= PersonalizationSettingsUpdated;
_themeService.AccentColorChanged -= AccentColorChanged;
_themeService.ElementThemeChanged -= ElementThemeChanged;
if (AppThemes != null)
{
AppThemes.Clear();
AppThemes = null;
}
}
private void PersonalizationSettingsUpdated(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (isPropChangeDisabled)
return;
if (e.PropertyName == nameof(SelectedElementTheme) && SelectedElementTheme != null)
{
_themeService.RootTheme = SelectedElementTheme.NativeTheme;
}
else if (e.PropertyName == nameof(SelectedAppTheme))
{
_themeService.CurrentApplicationThemeId = SelectedAppTheme.Id;
}
else
{
if (e.PropertyName == nameof(SelectedInfoDisplayMode))
PreferencesService.MailItemDisplayMode = SelectedInfoDisplayMode;
else if (e.PropertyName == nameof(SelectedAppColor))
_themeService.AccentColor = SelectedAppColor.Hex;
}
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Wino.Core.Domain;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Settings;
using Wino.Messaging.Client.Navigation;
namespace Wino.Core.ViewModels
{
public partial class SettingOptionsPageViewModel : CoreBaseViewModel
{
private readonly ISettingsBuilderService _settingsBuilderService;
[RelayCommand]
private void GoAccountSettings() => Messenger.Send<NavigateManageAccountsRequested>();
[RelayCommand]
public void NavigateSubDetail(object type)
{
if (type is WinoPage pageType)
{
if (pageType == WinoPage.AccountManagementPage)
{
GoAccountSettings();
return;
}
string pageTitle = pageType switch
{
WinoPage.PersonalizationPage => Translator.SettingsPersonalization_Title,
WinoPage.AboutPage => Translator.SettingsAbout_Title,
WinoPage.MessageListPage => Translator.SettingsMessageList_Title,
WinoPage.ReadComposePanePage => Translator.SettingsReadComposePane_Title,
WinoPage.LanguageTimePage => Translator.SettingsLanguageTime_Title,
WinoPage.AppPreferencesPage => Translator.SettingsAppPreferences_Title,
WinoPage.CalendarSettingsPage => Translator.SettingsCalendarSettings_Title,
_ => throw new NotImplementedException()
};
Messenger.Send(new BreadcrumbNavigationRequested(pageTitle, pageType));
}
}
[ObservableProperty]
private List<SettingOption> _settingOptions = new();
public SettingOptionsPageViewModel(ISettingsBuilderService settingsBuilderService)
{
_settingsBuilderService = settingsBuilderService;
ReloadSettings();
}
private void ReloadSettings()
{
SettingOptions = _settingsBuilderService.GetSettingItems();
}
}
}

View File

@@ -0,0 +1,14 @@
using Wino.Core.Domain.Interfaces;
namespace Wino.Core.ViewModels
{
public class SettingsPageViewModel : CoreBaseViewModel
{
public SettingsPageViewModel(INavigationService navigationService)
{
NavigationService = navigationService;
}
public INavigationService NavigationService { get; }
}
}

View File

@@ -0,0 +1,11 @@
using Wino.Core.Domain.Interfaces;
namespace Wino.Core.ViewModels
{
public class SettingsDialogViewModel : CoreBaseViewModel
{
public SettingsDialogViewModel(IMailDialogService dialogService)
{
}
}
}

View File

@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>12</LangVersion>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IsExternalInit" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.6" />
<PackageReference Include="System.Reactive" Version="6.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Wino.Core.Domain\Wino.Core.Domain.csproj" />
<ProjectReference Include="..\Wino.Core\Wino.Core.csproj" />
<ProjectReference Include="..\Wino.Messages\Wino.Messaging.csproj" />
</ItemGroup>
</Project>