Multithreading with EventWaitHandle

For the week, I’ve found the bug caused the pick module thread fails to refresh the sales order data grid view. This is because when the data grid collection had been initialize with new data at outside of the thread, it will no longer able to update the data grid collection and reflect in UI.

Therefore, I’ve implement EventWaitHandle to solve the issue. When user had clicked on the filter sales order check box, it send signal to the thread in order to refresh the sales order data grid view immediately. While the thread will always loop the function at 5 seconds interval by using WaitOne(TimeSpan.FromSeconds(5));

Not only that, I’ve also set the EventResetMode to AutoReset which will always set the event state to false after received signal.

Leave a Reply