You have to use a lock statement to protect your shared resource : the dictionary.
private object _lock = new object();
private void Reset()
{
lock(_lock)
{
// your code here
}
}
void f_PriceChanged(Objet f, eventData e)
{
lock(_lock)
{
if (prices.ContainsKey(e.ItemText))
prices[e.ItemText] = e.price;
else
prices.Add(e.ItemText, e.price);
}
}
You'll have to make f_PriceChanged()
a member.
Seb
2010-04-08 09:23:45