mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-24 19:00:04 +08:00
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using ReactiveUI;
|
|
using System.Application.Models.Settings;
|
|
using System.Application.UI.Resx;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace System.Application.UI.ViewModels
|
|
{
|
|
public class SettingsPageViewModel : TabItemViewModel
|
|
{
|
|
public static SettingsPageViewModel Instance { get; } = new SettingsPageViewModel();
|
|
|
|
public override string Name
|
|
{
|
|
get => AppResources.Settings;
|
|
protected set { throw new NotImplementedException(); }
|
|
}
|
|
|
|
KeyValuePair<string, string> _SelectLanguage;
|
|
public KeyValuePair<string, string> SelectLanguage
|
|
{
|
|
get => _SelectLanguage;
|
|
protected set => this.RaiseAndSetIfChanged(ref _SelectLanguage, value);
|
|
}
|
|
|
|
public SettingsPageViewModel()
|
|
{
|
|
SelectLanguage = R.Languages.SingleOrDefault(x => x.Key == UISettings.Language.Value);
|
|
if (SelectLanguage.Key == null)
|
|
SelectLanguage = R.Languages.First();
|
|
this.WhenAnyValue(x => x.SelectLanguage)
|
|
.Subscribe(x => UISettings.Language.Value = x.Key);
|
|
}
|
|
}
|
|
} |