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

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

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

@ -209,20 +209,20 @@ namespace STranslate.ViewModel
{ {
try 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("尚未配置任何翻译接口服务"); if (TranslationInterface.Count < 1) throw new Exception("尚未配置任何翻译接口服务");
try try
{ {
//配置读取接口 //配置读取接口
SelectedTranslationInterface = TranslationInterface[GlobalConfig.SelectServer]; SelectedTranslationInterface = TranslationInterface[_GlobalConfig.SelectServer];
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -230,8 +230,8 @@ namespace STranslate.ViewModel
} }
//从配置读取source target //从配置读取source target
InputComboSelected = GlobalConfig.SourceLanguage; InputComboSelected = _GlobalConfig.SourceLanguage;
OutputComboSelected = GlobalConfig.TargetLanguage; OutputComboSelected = _GlobalConfig.TargetLanguage;
return true; return true;
} }
@ -251,7 +251,7 @@ namespace STranslate.ViewModel
SourceLanguage = InputComboSelected, SourceLanguage = InputComboSelected,
TargetLanguage = OutputComboSelected, TargetLanguage = OutputComboSelected,
SelectServer = TranslationInterface.FindIndex(x => x == SelectedTranslationInterface), SelectServer = TranslationInterface.FindIndex(x => x == SelectedTranslationInterface),
Servers = GlobalConfig.Servers, Servers = _GlobalConfig.Servers,
}); });
} }
catch (Exception ex) catch (Exception ex)
@ -401,7 +401,7 @@ namespace STranslate.ViewModel
/// <summary> /// <summary>
/// 全局配置文件 /// 全局配置文件
/// </summary> /// </summary>
public ConfigModel GlobalConfig; private ConfigModel _GlobalConfig;
/// <summary> /// <summary>
/// 识别语种 /// 识别语种

Loading…
Cancel
Save