My program need to show some text to show for x amount of seconds. The problem is that the text only appears after the timespan check is done. Here is my code:
// Clicks button to show texts
//Displays text wanted basicly Text.Visibility =Visibility.Visible;
DisplayWords();
//Waits x amount of seconds before hidden them
int nbOfSecondsToWait = Convert.ToInt32(SecondAffichage.Value);
DateTime timeNow;
timeNow = DateTime.Now;
TimeSpan timePassed = (DateTime.Now - timeNow);
TimeSpan timePassedWanted = new TimeSpan(0, 0, nbOfSecondsToWait);
while (timePassed < timePassedWanted)
{
timePassed = DateTime.Now - timeNow;
}
//Hide texts
My text only appears after the timespan check and then get hidden immediately