mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
refactor SettingViewModel
This commit is contained in:
@@ -66,7 +66,7 @@ internal sealed partial class SettingViewModel : Abstraction.ViewModel
|
||||
get => selectedBackdropType ??= Options.BackdropTypes.Single(t => t.Value == Options.BackdropType);
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref selectedBackdropType, value) && value != null)
|
||||
if (SetProperty(ref selectedBackdropType, value) && value is not null)
|
||||
{
|
||||
Options.BackdropType = value.Value;
|
||||
}
|
||||
@@ -81,23 +81,14 @@ internal sealed partial class SettingViewModel : Abstraction.ViewModel
|
||||
get => selectedCulture ??= Options.Cultures.FirstOrDefault(c => c.Value == Options.CurrentCulture.Name);
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref selectedCulture, value))
|
||||
if (SetProperty(ref selectedCulture, value) && value is not null)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
Options.CurrentCulture = CultureInfo.GetCultureInfo(value.Value);
|
||||
AppInstance.Restart(string.Empty);
|
||||
}
|
||||
Options.CurrentCulture = CultureInfo.GetCultureInfo(value.Value);
|
||||
AppInstance.Restart(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override Task OpenUIAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
[Command("SetGamePathCommand")]
|
||||
private async Task SetGamePathAsync()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user