I have a function as below.
private void AddPrice(String value)
{
Delegate del=new Action<String>(AddToCollection);
this.Dispatcher.BeginInvoke(del,DipatcherPriority.Background,value);
}
In AddToCollection method, the value will be added to Observable Collection.
“AddPrice” function will be called based on user input(Eg. 100 times, 200 times, 300 times).
the maximum count of Observable collection is 150. If it reaches 150, I have to pop up Messagebox to user and need to cancle adding values. But, If the function is called 200 times, the messagebox is showing 50 times bse of BeginInvoke. How can I modify this? thanks.
You have two options:
So, you can stop this process on receiver or on the sender side.