mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-25 08:10:48 -05:00
Fix 7 change handlers not updating Entity + subform styling
Critical: OnChanged handlers now write to Entity immediately: - OnGenderChanged: Entity.Gender = value - OnIsInfectedChanged: Entity.IsPokerusInfected = value - OnSelectedHeldItemChanged: Entity.HeldItem sync - OnSelectedAbilityChanged: Entity.Ability sync - OnNicknameChanged: Entity.Nickname = value - OnIsEggChanged: Entity.IsEgg = value - OnIsShinyChanged: Entity.SetShiny/SetPIDGender Without these, Entity was stale during editing — legality checks and sprite updates used old data until PreparePKM was called. Subform: Fix SAVRTC2View title font size.
This commit is contained in:
parent
2e7fcb24b3
commit
360ccc21df
|
|
@ -58,8 +58,11 @@ public partial class PKMEditorViewModel : ObservableObject
|
|||
partial void OnGenderChanged(byte value)
|
||||
{
|
||||
OnPropertyChanged(nameof(GenderSymbol));
|
||||
if (!_isPopulating)
|
||||
if (!_isPopulating && Entity is not null)
|
||||
{
|
||||
Entity.Gender = value;
|
||||
UpdateSprite();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Tooltip showing the numeric species ID.</summary>
|
||||
|
|
@ -126,6 +129,8 @@ public string NatureTooltip
|
|||
partial void OnIsInfectedChanged(bool value)
|
||||
{
|
||||
OnPropertyChanged(nameof(ShowPkrsDetails));
|
||||
if (!_isPopulating && Entity is not null)
|
||||
Entity.IsPokerusInfected = value;
|
||||
}
|
||||
|
||||
// Shiny display indicators
|
||||
|
|
@ -708,8 +713,11 @@ private void UpdateRegionNames()
|
|||
{
|
||||
if (value is not null)
|
||||
HeldItem = value.Value;
|
||||
if (!_isPopulating)
|
||||
if (!_isPopulating && Entity is not null)
|
||||
{
|
||||
Entity.HeldItem = HeldItem;
|
||||
UpdateLegality();
|
||||
}
|
||||
}
|
||||
|
||||
partial void OnSelectedMove1Changed(ComboItem? value)
|
||||
|
|
@ -748,8 +756,11 @@ private void UpdateRegionNames()
|
|||
{
|
||||
if (value is not null)
|
||||
Ability = value.Value;
|
||||
if (!_isPopulating)
|
||||
if (!_isPopulating && Entity is not null)
|
||||
{
|
||||
Entity.Ability = Ability;
|
||||
UpdateLegality();
|
||||
}
|
||||
}
|
||||
|
||||
partial void OnSelectedLanguageChanged(ComboItem? value)
|
||||
|
|
@ -2057,6 +2068,7 @@ private async Task ShowFullLegalityReport()
|
|||
partial void OnNicknameChanged(string value)
|
||||
{
|
||||
if (_isPopulating || Entity is null) return;
|
||||
Entity.Nickname = value;
|
||||
var defaultName = SpeciesName.GetSpeciesNameGeneration(Entity.Species, Entity.Language, Entity.Format);
|
||||
if (value != defaultName)
|
||||
IsNicknamed = true;
|
||||
|
|
@ -2092,8 +2104,9 @@ private async Task ShowFullLegalityReport()
|
|||
|
||||
partial void OnIsEggChanged(bool value)
|
||||
{
|
||||
if (!_isPopulating)
|
||||
if (!_isPopulating && Entity is not null)
|
||||
{
|
||||
Entity.IsEgg = value;
|
||||
UpdateLegality();
|
||||
UpdateSprite();
|
||||
}
|
||||
|
|
@ -2102,8 +2115,12 @@ private async Task ShowFullLegalityReport()
|
|||
|
||||
partial void OnIsShinyChanged(bool value)
|
||||
{
|
||||
if (!_isPopulating)
|
||||
if (!_isPopulating && Entity is not null)
|
||||
{
|
||||
if (value && !Entity.IsShiny) Entity.SetShiny();
|
||||
else if (!value && Entity.IsShiny) Entity.SetPIDGender(Entity.Gender);
|
||||
UpdateSprite();
|
||||
}
|
||||
}
|
||||
|
||||
// --- IV changed handlers → recalc stats + legality ---
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
</StackPanel>
|
||||
|
||||
<StackPanel Spacing="8" VerticalAlignment="Center">
|
||||
<TextBlock Text="Gen 2 Crystal Real-Time Clock" FontWeight="SemiBold" FontSize="12" />
|
||||
<TextBlock Text="Gen 2 Crystal Real-Time Clock" FontWeight="SemiBold" FontSize="13" />
|
||||
<TextBlock Text="{Binding StatusText}" TextWrapping="Wrap" FontSize="11" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user