I am creating a time clock program. Our office staff would like to be able to send messages to specific employees when they clock in. The issue I have is if there are multiple messages to display, it loops through to the last one.
while(reader.Read()
{
richtextbox.Text = reader["Message"].ToString();
//need to pause here and wait for them to press the acknowledge button
{
Is there a way to wait or pause until the press the acknowledge button.
Any help is appreciated.
ps. I have tried using
public static class Utils
{
public static Task WhenClicked(this Control target)
{
var tcs = new TaskCompletionSource<object>();
EventHandler onClick = null;
onClick = (sender, e) =>
{
target.Click -= onClick;
tcs.TrySetResult(null);
};
target.Click += onClick;
return tcs.Task;
}
}
from this thread Wait until a click event has been fired C# but It did the same thing and blew past the button and showed the last message again.