0

Hello I am trying to show a label when the condition is true and I want it to be timed controlled so it will disappear in a couple of seconds.The program is an app and uses the .xaml extension, it does not have forms. The examples I have found online are when the label is handled by an event, not by a conditional statement. Any help appreciated.

 private void InterpretCommand(SpeechRecognizedEventArgs e)
        {


            if (e.Result.Text == "Start")         // initially only recognize starting and ending voice control   
            {
                activeVoiceControl = true;

                aTimer = new System.Timers.Timer(3000);
                label1.Visibility = Visibility.Visible;
                aTimer.Start();
                aTimer.Stop();
                label1.Visibility = Visibility.Collapsed;
            }
        }
2
Contributors
1
Reply
9
Views
4 Years
Discussion Span
Last Post by Ketsuekiame
0

Your use of the timer control is incorrect. The principle is the same; set a callback for your timer (I think it's called Tick or similar) in that callback, you need to collapse your label and stop the timer.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.