修复设置中文件命名格式的一些问题

croire 3 years ago
parent 6a3b1e96b5
commit 966b707165

@ -240,7 +240,7 @@ namespace DownKyi.Core.Settings
public List<FileNamePart> GetFileNameParts() public List<FileNamePart> GetFileNameParts()
{ {
appSettings = GetSettings(); appSettings = GetSettings();
if (appSettings.Video.FileNameParts == null) if (appSettings.Video.FileNameParts == null || appSettings.Video.FileNameParts.Count == 0)
{ {
// 第一次获取,先设置默认值 // 第一次获取,先设置默认值
SetFileNameParts(fileNameParts); SetFileNameParts(fileNameParts);

@ -85,6 +85,13 @@ namespace DownKyi.ViewModels.Settings
set => SetProperty(ref optionalFields, value); set => SetProperty(ref optionalFields, value);
} }
private int selectedOptionalField;
public int SelectedOptionalField
{
get => selectedOptionalField;
set => SetProperty(ref selectedOptionalField, value);
}
#endregion #endregion
@ -112,6 +119,8 @@ namespace DownKyi.ViewModels.Settings
OptionalFields.Add(new DisplayFileNamePart { Id = item, Title = display }); OptionalFields.Add(new DisplayFileNamePart { Id = item, Title = display });
} }
SelectedOptionalField = -1;
#endregion #endregion
} }
@ -279,6 +288,11 @@ namespace DownKyi.ViewModels.Settings
/// <param name="parameter"></param> /// <param name="parameter"></param>
private void ExecuteOptionalFieldsCommand(object parameter) private void ExecuteOptionalFieldsCommand(object parameter)
{ {
if (SelectedOptionalField == -1)
{
return;
}
SelectedFileName.Add((DisplayFileNamePart)parameter); SelectedFileName.Add((DisplayFileNamePart)parameter);
List<FileNamePart> fileName = new List<FileNamePart>(); List<FileNamePart> fileName = new List<FileNamePart>();
@ -289,6 +303,8 @@ namespace DownKyi.ViewModels.Settings
bool isSucceed = SettingsManager.GetInstance().SetFileNameParts(fileName); bool isSucceed = SettingsManager.GetInstance().SetFileNameParts(fileName);
PublishTip(isSucceed); PublishTip(isSucceed);
SelectedOptionalField = -1;
} }

@ -160,6 +160,7 @@
x:Name="nameSelectedFileName" x:Name="nameSelectedFileName"
Grid.Row="0" Grid.Row="0"
Grid.Column="1" Grid.Column="1"
MinHeight="30"
Margin="0,0,0,20" Margin="0,0,0,20"
ItemContainerStyle="{StaticResource TagItem2Style}" ItemContainerStyle="{StaticResource TagItem2Style}"
ItemsSource="{Binding SelectedFileName, Mode=TwoWay}" ItemsSource="{Binding SelectedFileName, Mode=TwoWay}"
@ -184,6 +185,7 @@
Grid.Column="1" Grid.Column="1"
ItemContainerStyle="{StaticResource TagItem2Style}" ItemContainerStyle="{StaticResource TagItem2Style}"
ItemsSource="{Binding OptionalFields, Mode=TwoWay}" ItemsSource="{Binding OptionalFields, Mode=TwoWay}"
SelectedIndex="{Binding SelectedOptionalField}"
SelectionMode="Single" SelectionMode="Single"
Style="{StaticResource Tag2Style}"> Style="{StaticResource Tag2Style}">
<i:Interaction.Triggers> <i:Interaction.Triggers>

Loading…
Cancel
Save