You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.8 KiB
64 lines
1.8 KiB
using System.Collections.ObjectModel; |
|
using System.Threading.Tasks; |
|
using Avalonia.Controls.Notifications; |
|
using CommunityToolkit.Mvvm.ComponentModel; |
|
using CommunityToolkit.Mvvm.Input; |
|
using FluentAvalonia.UI.Controls; |
|
using StabilityMatrix.Avalonia.Services; |
|
using StabilityMatrix.Avalonia.Views; |
|
using StabilityMatrix.Core.Attributes; |
|
|
|
namespace StabilityMatrix.Avalonia.ViewModels; |
|
|
|
[View(typeof(SettingsPage))] |
|
public partial class SettingsViewModel : PageViewModelBase |
|
{ |
|
private readonly INotificationService notificationService; |
|
|
|
public override string Title => "Settings"; |
|
public override Symbol Icon => Symbol.Setting; |
|
|
|
[ObservableProperty] |
|
private string? selectedTheme; |
|
|
|
public ObservableCollection<string> AvailableThemes { get; } = new() |
|
{ |
|
"Light", |
|
"Dark", |
|
"System", |
|
}; |
|
|
|
public SettingsViewModel(INotificationService notificationService) |
|
{ |
|
this.notificationService = notificationService; |
|
|
|
SelectedTheme = AvailableThemes[1]; |
|
} |
|
|
|
[RelayCommand] |
|
private void DebugNotification() |
|
{ |
|
notificationService.Show(new Notification( |
|
title: "Test Notification", |
|
message: "Here is some message", |
|
type: NotificationType.Information)); |
|
} |
|
|
|
[RelayCommand] |
|
private async Task DebugContentDialog() |
|
{ |
|
var dialog = new ContentDialog |
|
{ |
|
Title = "Test title", |
|
PrimaryButtonText = "OK", |
|
CloseButtonText = "Close" |
|
}; |
|
|
|
var result = await dialog.ShowAsync(); |
|
notificationService.Show(new Notification("Content dialog closed", |
|
$"Result: {result}")); |
|
} |
|
|
|
public override bool CanNavigateNext { get; protected set; } |
|
public override bool CanNavigatePrevious { get; protected set; } |
|
}
|
|
|