Nu är det ordning på funktionaliteten när det gäller att hantera spelare nya spelronder och den poänghistorik som lagras

This commit is contained in:
2025-09-23 22:11:02 +02:00
parent d20c0095cc
commit 8f8f8e70e9
14 changed files with 229 additions and 74 deletions

View File

@ -0,0 +1,29 @@
namespace GreadyPoang.Common;
public class BehaviorBase<T> : Behavior<T> where T : BindableObject
{
public T AssociatedObject { get; private set; }
protected override void OnAttachedTo(T bindable)
{
base.OnAttachedTo(bindable);
AssociatedObject = bindable;
if (bindable.BindingContext != null)
BindingContext = bindable.BindingContext;
bindable.BindingContextChanged += OnBindingContextChanged;
}
protected override void OnDetachingFrom(T bindable)
{
base.OnDetachingFrom(bindable);
bindable.BindingContextChanged -= OnBindingContextChanged;
AssociatedObject = null;
}
void OnBindingContextChanged(object sender, EventArgs e)
{
BindingContext = AssociatedObject.BindingContext;
}
}