perf: add theme re/wr with config

dev_config
SONGE9B3\song_pd_win11 2 years ago
parent a6d9a6ae09
commit 8a56d109fd

@ -25,6 +25,9 @@ namespace STranslate.ViewModel
Environment.Exit(-1); Environment.Exit(-1);
} }
InputCombo = LanguageEnumDict.Keys.ToList();
OutputCombo = LanguageEnumDict.Keys.ToList();
//复制输入 //复制输入
CopyInputCmd = new RelayCommand((_) => true, (_) => CopyInputCmd = new RelayCommand((_) => true, (_) =>
{ {
@ -79,9 +82,11 @@ namespace STranslate.ViewModel
{ {
try try
{ {
InputCombo = LanguageEnumDict.Keys.ToList();
OutputCombo = LanguageEnumDict.Keys.ToList();
GlobalConfig = ConfigHelper.Instance.ReadConfig<ConfigModel>(); GlobalConfig = ConfigHelper.Instance.ReadConfig<ConfigModel>();
//配置读取主题
Application.Current.Resources.MergedDictionaries[0].Source = GlobalConfig.IsBright ? new Uri(_ThemeDefault) : new Uri(_ThemeDark);
//更新服务 //更新服务
TranslationInterface = GlobalConfig.Servers.ToList(); TranslationInterface = GlobalConfig.Servers.ToList();
@ -115,7 +120,7 @@ namespace STranslate.ViewModel
{ {
ConfigHelper.Instance.WriteConfig(new ConfigModel ConfigHelper.Instance.WriteConfig(new ConfigModel
{ {
IsBright = true, IsBright = Application.Current.Resources.MergedDictionaries[0].Source.ToString() == _ThemeDefault ? true : false,
SourceLanguage = InputComboSelected, SourceLanguage = InputComboSelected,
TargetLanguage = OutputComboSelected, TargetLanguage = OutputComboSelected,
SelectServer = TranslationInterface.FindIndex(x => x == SelectedTranslationInterface), SelectServer = TranslationInterface.FindIndex(x => x == SelectedTranslationInterface),

Loading…
Cancel
Save