dev_split_view_vm
DESKTOP-3BO4HSG\ksat 2 years ago
parent 06a30fcad5
commit c020e31e30

@ -17,6 +17,7 @@
ResizeMode="NoResize"
Topmost="True"
Deactivated="Window_Deactivated"
Closing="Mwin_Closing"
WindowStyle="None"
SizeToContent="Height"
Width="400"

@ -79,5 +79,10 @@ namespace STranslate.View
this.Hide();
}
}
private void Mwin_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
HotkeysHelper.UnRegisterHotKey();
}
}
}

@ -209,20 +209,20 @@ namespace STranslate.ViewModel
{
try
{
GlobalConfig = ConfigHelper.Instance.ReadConfig<ConfigModel>();
_GlobalConfig = ConfigHelper.Instance.ReadConfig<ConfigModel>();
//配置读取主题
Application.Current.Resources.MergedDictionaries[0].Source = GlobalConfig.IsBright ? new Uri(_ThemeDefault) : new Uri(_ThemeDark);
Application.Current.Resources.MergedDictionaries[0].Source = _GlobalConfig.IsBright ? new Uri(_ThemeDefault) : new Uri(_ThemeDark);
//更新服务
TranslationInterface = GlobalConfig.Servers.ToList();
TranslationInterface = _GlobalConfig.Servers.ToList();
if (TranslationInterface.Count < 1) throw new Exception("尚未配置任何翻译接口服务");
try
{
//配置读取接口
SelectedTranslationInterface = TranslationInterface[GlobalConfig.SelectServer];
SelectedTranslationInterface = TranslationInterface[_GlobalConfig.SelectServer];
}
catch (Exception ex)
{
@ -230,8 +230,8 @@ namespace STranslate.ViewModel
}
//从配置读取source target
InputComboSelected = GlobalConfig.SourceLanguage;
OutputComboSelected = GlobalConfig.TargetLanguage;
InputComboSelected = _GlobalConfig.SourceLanguage;
OutputComboSelected = _GlobalConfig.TargetLanguage;
return true;
}
@ -251,7 +251,7 @@ namespace STranslate.ViewModel
SourceLanguage = InputComboSelected,
TargetLanguage = OutputComboSelected,
SelectServer = TranslationInterface.FindIndex(x => x == SelectedTranslationInterface),
Servers = GlobalConfig.Servers,
Servers = _GlobalConfig.Servers,
});
}
catch (Exception ex)
@ -401,7 +401,7 @@ namespace STranslate.ViewModel
/// <summary>
/// 全局配置文件
/// </summary>
public ConfigModel GlobalConfig;
private ConfigModel _GlobalConfig;
/// <summary>
/// 识别语种

Loading…
Cancel
Save