I am trying to share an observable colletion between haxe code and UI code.
Given that the observible collection could only be modified by the UI thread, I am using an overriden version of the library that is overriding the add method to dispatch the UI thread.
For some odd reason, the haxe compiler is casting the instance to the base class before calling the Add method, causing the original Method to be calle instead of the original,
Any workaround?
Haxe
public var conv_status=new mintplayer.observablecollection.ObservableCollection_1<KV>();
conv_status.Add({k:"Init",v:Date.now().toString()});
Library
public new void Add(T item)
{
CheckReentrancy();
RunOnMainThread((param) =>
{
base.Add(param);
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, param));
}, item );
}
Haxe generated code
( this.conv_status as global::System.Collections.ObjectModel.Collection<global::conveyor.KV> ).Add(((global::conveyor.KV) (new global::conveyor.KV(((string) (key) ), ((string) (val) ))) ));