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:NotEqualsConverter x:Key="NotEqualsConverter" />
|
||||||
<c:NullToFalseConverter x:Key="NullToFalseConverter" />
|
<c:NullToFalseConverter x:Key="NullToFalseConverter" />
|
||||||
<c:AllTrueToCollapsedConverter x:Key="AllTrueToCollapsedConverter" />
|
<c:AllTrueToCollapsedConverter x:Key="AllTrueToCollapsedConverter" />
|
||||||
|
<c:BoolInverter x:Key="BoolInverter" />
|
||||||
</ResourceDictionary>
|
</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>
|
||||||
/// 不显示本体宠物
|
/// 不显示本体宠物
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ObservableValue<bool> DontShowMainPet { get; } = new(true);
|
public ObservableValue<bool> ShowMainPet { get; } = new(true);
|
||||||
|
|
||||||
#region ModInfo
|
#region ModInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -138,7 +138,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
DescriptionId.Value = $"{n}_{nameof(DescriptionId)}";
|
DescriptionId.Value = $"{n}_{nameof(DescriptionId)}";
|
||||||
};
|
};
|
||||||
Pets.CollectionChanged += Pets_CollectionChanged;
|
Pets.CollectionChanged += Pets_CollectionChanged;
|
||||||
DontShowMainPet.ValueChanged += ShowMainPet_ValueChanged;
|
ShowMainPet.ValueChanged += ShowMainPet_ValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowMainPet_ValueChanged(
|
private void ShowMainPet_ValueChanged(
|
||||||
@ -151,10 +151,10 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
|
|
||||||
private void Pets_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
private void Pets_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (DontShowMainPet.Value)
|
if (ShowMainPet.Value)
|
||||||
PetDisplayedCount.Value = Pets.Count - Pets.Count(m => m.FromMain.Value);
|
|
||||||
else
|
|
||||||
PetDisplayedCount.Value = Pets.Count;
|
PetDisplayedCount.Value = Pets.Count;
|
||||||
|
else
|
||||||
|
PetDisplayedCount.Value = Pets.Count - Pets.Count(m => m.FromMain.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModInfoModel(ModLoader loader)
|
public ModInfoModel(ModLoader loader)
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Converters\AllTrueToCollapsedConverter.cs" />
|
<Compile Include="Converters\AllTrueToCollapsedConverter.cs" />
|
||||||
<Compile Include="Converters\AnyFalseToVisibleConverter.cs" />
|
<Compile Include="Converters\AnyFalseToVisibleConverter.cs" />
|
||||||
|
<Compile Include="Converters\BoolInverter.cs" />
|
||||||
<Compile Include="Models\I18nModelBase.cs" />
|
<Compile Include="Models\I18nModelBase.cs" />
|
||||||
<Compile Include="Usings.cs" />
|
<Compile Include="Usings.cs" />
|
||||||
<Compile Include="Converters\BrushToMediaColorConverter.cs" />
|
<Compile Include="Converters\BrushToMediaColorConverter.cs" />
|
||||||
|
@ -48,7 +48,10 @@
|
|||||||
<Setter Property="Visibility">
|
<Setter Property="Visibility">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<MultiBinding Converter="{StaticResource AllTrueToCollapsedConverter}">
|
<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" />
|
<Binding Path="FromMain.Value" />
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
|
@ -48,7 +48,10 @@
|
|||||||
<Setter Property="Visibility">
|
<Setter Property="Visibility">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<MultiBinding Converter="{StaticResource AllTrueToCollapsedConverter}">
|
<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" />
|
<Binding Path="FromMain.Value" />
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}" />
|
Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
<pu:Switch
|
<pu:Switch
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Content="{ll:Str 不显示本体宠物}"
|
Content="{ll:Str 显示本体宠物}"
|
||||||
IsChecked="{Binding ModInfo.DontShowMainPet.Value}" />
|
IsChecked="{Binding ModInfo.ShowMainPet.Value}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<DataGrid
|
<DataGrid
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
@ -53,7 +53,10 @@
|
|||||||
<Setter Property="Visibility">
|
<Setter Property="Visibility">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<MultiBinding Converter="{StaticResource AllTrueToCollapsedConverter}">
|
<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" />
|
<Binding Path="FromMain.Value" />
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
|
@ -52,7 +52,10 @@
|
|||||||
<Setter Property="Visibility">
|
<Setter Property="Visibility">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<MultiBinding Converter="{StaticResource AllTrueToCollapsedConverter}">
|
<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" />
|
<Binding Path="FromMain.Value" />
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
|
@ -92,8 +92,7 @@
|
|||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
d:Text="{ll:Str 路径}"
|
d:Text="{ll:Str 路径}"
|
||||||
Text="{Binding SourcePath}"
|
Text="{Binding SourcePath}" />
|
||||||
TextWrapping="Wrap" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
Loading…
Reference in New Issue
Block a user