I have some code that starts a background process for search in my WPF application:
private void RunSearch(SearchArguments arguments)
{
_getSearchResults.DoWork += GetSarchFromDb;
_getSearchResults.RunWorkerCompleted += SearchFinished;
_getSearchResults.RunWorkerAsync(arguments);
}
RunSearch is exicuted from button_click event.
I have a messagebox inside my SearchFinished method that shows "No Results Found". For some reason, the SearchFinished method is called multiple times sometimes, which causes multiple MessageBoxes to be shown. Is there a workaround for this?