I have Form responsible for logging all neccessary informations from all thread into its richTextBox. I use Invoke when I want to access its controls from diffrent threads (to append text to richTextBox) and it works perfectly.
But I need this log form to be shown when first message is going to be append to richTextBox and I won’t know which from my threads will do this first.
Also when I close log form, I want it to be shown again when next message comes (and in this case I still won’t know which thread will call it first).
I tried to create this form in new threads and via Application.Run(ApplicationContext) but none of this solutions worked.
Do you have any hints?
Similar to this other reply I will enqueue the message and letting the form dequeuiong them, so the order will be preserved. Some concurrent strategy has to be provided to let the threads feed the queue while the form is dequeuing them, but you ensure the order of events is preserved, and you can start the form at the first event seen.