mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 02:55:38 +08:00
fix: 修复配置名为null时添加配置报错,留空时以当前时间作为配置名
This commit is contained in:
@@ -316,6 +316,11 @@ namespace MaaWpfGui.Helper
|
||||
|
||||
public static bool AddConfiguration(string configName, string copyFrom = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(configName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_kvsMap.ContainsKey(configName))
|
||||
{
|
||||
_logger.Warning("Configuration {ConfigName} already exists", configName);
|
||||
|
||||
@@ -930,6 +930,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
public void AddConfiguration()
|
||||
{
|
||||
NewConfigurationName ??= DateTime.Now.ToString("yy/MM/dd HH:mm:ss");
|
||||
if (ConfigurationHelper.AddConfiguration(NewConfigurationName, CurrentConfiguration))
|
||||
{
|
||||
ConfigurationList.Add(new CombinedData { Display = NewConfigurationName, Value = NewConfigurationName });
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Grid Width="200">
|
||||
<Grid Width="250">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
@@ -65,6 +65,7 @@
|
||||
<controls:TextBlock Grid.Column="0" Text="{DynamicResource ConfigurationName}" />
|
||||
<TextBox
|
||||
Grid.Column="1"
|
||||
Width="Auto"
|
||||
Margin="10"
|
||||
Text="{Binding NewConfigurationName, UpdateSourceTrigger=PropertyChanged}">
|
||||
<TextBox.InputBindings>
|
||||
|
||||
Reference in New Issue
Block a user