mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 02:10:21 +08:00
perf: Config 创建和切换检查
This commit is contained in:
@@ -498,10 +498,16 @@ public class SettingsViewModel : Screen
|
||||
{
|
||||
get => _currentConfiguration;
|
||||
set {
|
||||
SetAndNotify(ref _currentConfiguration, value);
|
||||
ConfigurationHelper.SwitchConfiguration(value);
|
||||
ConfigFactory.SwitchConfig(value);
|
||||
bool ret = ConfigurationHelper.SwitchConfiguration(value);
|
||||
ret &= ConfigFactory.SwitchConfig(value);
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
ConfigurationHelper.SwitchConfiguration(_currentConfiguration);
|
||||
ConfigFactory.SwitchConfig(_currentConfiguration);
|
||||
return;
|
||||
}
|
||||
SetAndNotify(ref _currentConfiguration, value);
|
||||
Bootstrapper.ShutdownAndRestartWithoutArgs();
|
||||
}
|
||||
}
|
||||
@@ -540,6 +546,8 @@ public class SettingsViewModel : Screen
|
||||
}
|
||||
else
|
||||
{
|
||||
ConfigurationHelper.DeleteConfiguration(NewConfigurationName);
|
||||
ConfigFactory.DeleteConfiguration(NewConfigurationName);
|
||||
var growlInfo = new GrowlInfo {
|
||||
IsCustom = true,
|
||||
Message = string.Format(LocalizationHelper.GetString("ConfigExists"), NewConfigurationName),
|
||||
|
||||
Reference in New Issue
Block a user