don't apply changes when no changes

This commit is contained in:
2024-07-17 19:37:36 +02:00
parent 8273c68318
commit 675225658c

View File

@@ -29,16 +29,19 @@ public class NameplateElementChange(NameplateElements element, INamePlateUpdateH
public void ApplyChanges() public void ApplyChanges()
{ {
StringUpdateFactory.ApplyStringChanges(new() if (Changes.Any())
{ {
StringChanges = Changes, StringUpdateFactory.ApplyStringChanges(new()
Destination = element switch
{ {
NameplateElements.Name => handler.NameParts.Text ??= handler.InfoView.Name, StringChanges = Changes,
NameplateElements.Title => handler.TitleParts.Text ??= handler.InfoView.Title, Destination = element switch
NameplateElements.FreeCompany => handler.FreeCompanyTagParts.Text ??= handler.InfoView.FreeCompanyTag, {
_ => null, NameplateElements.Name => handler.NameParts.Text ??= handler.InfoView.Name,
}, NameplateElements.Title => handler.TitleParts.Text ??= handler.InfoView.Title,
}); NameplateElements.FreeCompany => handler.FreeCompanyTagParts.Text ??= handler.InfoView.FreeCompanyTag,
_ => null,
},
});
}
} }
} }