in_valparaiso
Member
- Joined
- Apr 5, 2019
- Messages
- 13
- Programming Experience
- 10+
I am using Task.Delay for a project I am working on, something I have not used before. Code below (thanks to jmcilhinney) looks similar to this:
public static async Task Typing(string text, Label lbl) {
lbl.Visible = true;
await Task.Delay((text.Length / 3) * 1000); // Average person types 3 characters a second. In doing this I can pause the average length of
// time to type the text being shown.
lbl.Visible = false
}
This works perfectly at pausing execution. What the pause does is makes a label visible which says a user is typing. After the delay, the label is hidden and execution proceeds.
Is there way that during the pause I would be able to play a wav file? During the pause I have a wav that sounds like someone is typing.
public static async Task Typing(string text, Label lbl) {
lbl.Visible = true;
await Task.Delay((text.Length / 3) * 1000); // Average person types 3 characters a second. In doing this I can pause the average length of
// time to type the text being shown.
lbl.Visible = false
}
This works perfectly at pausing execution. What the pause does is makes a label visible which says a user is typing. After the delay, the label is hidden and execution proceeds.
Is there way that during the pause I would be able to play a wav file? During the pause I have a wav that sounds like someone is typing.