Ok, guys, I have been able to get an indicator to process voice commands. I've attached the cs file because I have a lot of references for other stuff on my system that probably would stop a zip import on your system.
possibly you might need to install the .NET speech recognition references on your system. At the moment, I don't remember how I did that...
It seems there are just two problems remaining. there are print commands to trace what is happening.
1) the indicator will process the voice command only once. then I have to reload the indicator before it will listen again
2) the indicator is actively listening even if the chart it is on is not in focus....it needs to only listen when the panel/chart it is on is in focus so that it does not process commands when the user is not looking at the chart
Well, if anyone knows how to solve these two items, it seems those of us who want to talk to Ninja instead of having our hand on the mouse, this is one step closer.
now I need to find a way to know when the chart is active .... then I will try to start and stop the listener thread. I'll start the thread when the chart has focus and stop it when the chart looses focus...but so far I'm not having luck with the GOTFOCUS and LOSTFOCUS events for ChartControl.
ChartControl.ChartPanel.GotFocus += new EventHandler (ThisGotFocus);
ChartControl.ChartPanel.LostFocus += new EventHandler (ThisLostFocus);
but, now I'm not sure about starting a Thread (for the voice recognition) inside Ninja, if it is going to cause problems.
Because it seems when I press F5 (to reload the indicator) the existing thread is not terminated and a duplicate is started...not sure but it seems to be this way, and if so this is going to cause problems.
this is skeleton code for command processing...not a finished product...for other coders to play with
the indicator will only process commands when the Chart Panel it is on has focus. This means the indicator can be on many charts and the voice commands will only be processed on the Chart that has focus.
Debug code inside...with Print statments.
Let me know if you find any bugs.
The following 2 users say Thank You to vantojo for this post: