配置文件功能完善

This commit is contained in:
rmbgame
2021-03-06 11:01:13 +08:00
parent 3cbcabeedf
commit ca93b3f9c8
29 changed files with 906 additions and 77 deletions
@@ -1,4 +1,6 @@
using ReactiveUI;
using System.Application.Models.Settings;
using System.Application.UI.Resx;
using System.Collections.Generic;
using System.Linq;
using System.Properties;
@@ -58,8 +60,6 @@ namespace System.Application.UI.ViewModels
(this.ASFPage = new ArchiSteamFarmPlusPageViewModel().AddTo(this)),
(this.GameRelatedPage = new GameRelatedPageViewModel().AddTo(this)),
(this.OtherPlatformPage = new OtherPlatformPageViewModel().AddTo(this)),
#region SystemTab
SettingsPageViewModel.Instance,
@@ -72,15 +72,7 @@ namespace System.Application.UI.ViewModels
this.SelectedItem = this.TabItems.First();
if (ViewModelBase.IsInDesignMode)
{
return;
}
Task.Run(Initialize).ContinueWith(s =>
{
Log.Error(nameof(MainWindowViewModel), s.Exception, nameof(Initialize) + "Action Error");
}, TaskContinuationOptions.OnlyOnFaulted)
.ContinueWith(s => s.Dispose());
Task.Run(Initialize).ForgetAndDispose();
}
@@ -1,4 +1,5 @@
using ReactiveUI;
using System.Application.Models.Settings;
using System.Application.UI.Resx;
using System.Collections.Generic;
using System.Linq;
@@ -15,22 +16,20 @@ namespace System.Application.UI.ViewModels
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);
}
KeyValuePair<string, string> _CurrentLanguage = R.Languages.First();
public KeyValuePair<string, string> CurrentLanguage
{
get => _CurrentLanguage;
set
{
this.RaiseAndSetIfChanged(ref _CurrentLanguage, value);
R.ChangeLanguage(_CurrentLanguage.Key);
}
}
}
}