mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
更新
This commit is contained in:
parent
f75f2970ad
commit
1e7b3751ac
@ -14,4 +14,5 @@
|
||||
<c:NotEqualsConverter x:Key="NotEqualsConverter" />
|
||||
<c:NullToFalseConverter x:Key="NullToFalseConverter" />
|
||||
<c:AllTrueToCollapsedConverter x:Key="AllTrueToCollapsedConverter" />
|
||||
<c:BoolInverter x:Key="BoolInverter" />
|
||||
</ResourceDictionary>
|
24
VPet.ModMaker/Converters/BoolInverter.cs
Normal file
24
VPet.ModMaker/Converters/BoolInverter.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace VPet.ModMaker.Converters;
|
||||
|
||||
public class BoolInverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is not bool b)
|
||||
throw new ArgumentException("Value type not bool", nameof(value));
|
||||
return !b;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
||||
/// <summary>
|
||||
/// 不显示本体宠物
|
||||
/// </summary>
|
||||
public ObservableValue<bool> DontShowMainPet { get; } = new(true);
|
||||
public ObservableValue<bool> ShowMainPet { get; } = new(true);
|
||||
|
||||
#region ModInfo
|
||||
/// <summary>
|
||||
@ -138,7 +138,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
||||
DescriptionId.Value = $"{n}_{nameof(DescriptionId)}";
|
||||
};
|
||||
Pets.CollectionChanged += Pets_CollectionChanged;
|
||||
DontShowMainPet.ValueChanged += ShowMainPet_ValueChanged;
|
||||
ShowMainPet.ValueChanged += ShowMainPet_ValueChanged;
|
||||
}
|
||||
|
||||
private void ShowMainPet_ValueChanged(
|
||||
@ -151,10 +151,10 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
||||
|
||||
private void Pets_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (DontShowMainPet.Value)
|
||||
PetDisplayedCount.Value = Pets.Count - Pets.Count(m => m.FromMain.Value);
|
||||
else
|
||||
if (ShowMainPet.Value)
|
||||
PetDisplayedCount.Value = Pets.Count;
|
||||
else
|
||||
PetDisplayedCount.Value = Pets.Count - Pets.Count(m => m.FromMain.Value);
|
||||
}
|
||||
|
||||
public ModInfoModel(ModLoader loader)
|
||||
|
@ -100,6 +100,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Converters\AllTrueToCollapsedConverter.cs" />
|
||||
<Compile Include="Converters\AnyFalseToVisibleConverter.cs" />
|
||||
<Compile Include="Converters\BoolInverter.cs" />
|
||||
<Compile Include="Models\I18nModelBase.cs" />
|
||||
<Compile Include="Usings.cs" />
|
||||
<Compile Include="Converters\BrushToMediaColorConverter.cs" />
|
||||
|
@ -48,7 +48,10 @@
|
||||
<Setter Property="Visibility">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource AllTrueToCollapsedConverter}">
|
||||
<Binding Path="DataContext.ModInfo.DontShowMainPet.Value" RelativeSource="{RelativeSource AncestorType=Page}" />
|
||||
<Binding
|
||||
Converter="{StaticResource BoolInverter}"
|
||||
Path="DataContext.ModInfo.ShowMainPet.Value"
|
||||
RelativeSource="{RelativeSource AncestorType=Page}" />
|
||||
<Binding Path="FromMain.Value" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
|
@ -48,7 +48,10 @@
|
||||
<Setter Property="Visibility">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource AllTrueToCollapsedConverter}">
|
||||
<Binding Path="DataContext.ModInfo.DontShowMainPet.Value" RelativeSource="{RelativeSource AncestorType=Page}" />
|
||||
<Binding
|
||||
Converter="{StaticResource BoolInverter}"
|
||||
Path="DataContext.ModInfo.ShowMainPet.Value"
|
||||
RelativeSource="{RelativeSource AncestorType=Page}" />
|
||||
<Binding Path="FromMain.Value" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
|
@ -29,8 +29,8 @@
|
||||
Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<pu:Switch
|
||||
Grid.Column="1"
|
||||
Content="{ll:Str 不显示本体宠物}"
|
||||
IsChecked="{Binding ModInfo.DontShowMainPet.Value}" />
|
||||
Content="{ll:Str 显示本体宠物}"
|
||||
IsChecked="{Binding ModInfo.ShowMainPet.Value}" />
|
||||
</Grid>
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
@ -53,7 +53,10 @@
|
||||
<Setter Property="Visibility">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource AllTrueToCollapsedConverter}">
|
||||
<Binding Path="DataContext.ModInfo.DontShowMainPet.Value" RelativeSource="{RelativeSource AncestorType=Page}" />
|
||||
<Binding
|
||||
Converter="{StaticResource BoolInverter}"
|
||||
Path="DataContext.ModInfo.ShowMainPet.Value"
|
||||
RelativeSource="{RelativeSource AncestorType=Page}" />
|
||||
<Binding Path="FromMain.Value" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
|
@ -52,7 +52,10 @@
|
||||
<Setter Property="Visibility">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource AllTrueToCollapsedConverter}">
|
||||
<Binding Path="DataContext.ModInfo.DontShowMainPet.Value" RelativeSource="{RelativeSource AncestorType=Page}" />
|
||||
<Binding
|
||||
Converter="{StaticResource BoolInverter}"
|
||||
Path="DataContext.ModInfo.ShowMainPet.Value"
|
||||
RelativeSource="{RelativeSource AncestorType=Page}" />
|
||||
<Binding Path="FromMain.Value" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
|
@ -92,8 +92,7 @@
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Bottom"
|
||||
d:Text="{ll:Str 路径}"
|
||||
Text="{Binding SourcePath}"
|
||||
TextWrapping="Wrap" />
|
||||
Text="{Binding SourcePath}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
Loading…
Reference in New Issue
Block a user