Files
Phonebook/SettingsPage.xaml.cs
2026-04-09 13:10:02 +03:00

43 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Phonebook.Services;
namespace Phonebook;
public partial class SettingsPage : ContentPage
{
private readonly ThemeService _themeService;
private readonly ContactService _contactService;
public SettingsPage()
{
InitializeComponent();
_themeService = IPlatformApplication.Current!.Services.GetService<ThemeService>()!;
_contactService = IPlatformApplication.Current!.Services.GetService<ContactService>()!;
}
private async void GreenSelected(object? sender, EventArgs e)
{
await _themeService.ApplyTheme(AppThemeType.Green);
}
private async void BlueSelected(object? sender, EventArgs e)
{
await _themeService.ApplyTheme(AppThemeType.Blue);
}
private async void DarkSelected(object? sender, EventArgs e)
{
await _themeService.ApplyTheme(AppThemeType.Dark);
}
private async void ClearSelected(object? sender, EventArgs e)
{
await _contactService.ClearAllContacts();
await Shell.Current.GoToAsync("//MainPage");
}
}