Right now I'm trying to create a voice recognition assistant (basically a JARVIS program) using c#. I started off writing the code in visual studio, and once the code was working, I moved over to expression blend to work on the UI.
I've successfully imported the images and animated them on a loop. At that point, when I ran the program, everything worked (animations and speech recognition included). My next step was then to try and "replace" the standard window with the images I had just imported by setting the standard window to transparent. Using the panes, I then set all the brushes to "no brush," and I set allowstransparency to "true." When I ran the program, the animations still worked but the program stopped running all of the voice recognition code.
Through the process of elimination, I've isolated the problem to the background brush and the allowstransparency function. If I either set the allowstransparency to true or mess with the background brush in any way, there's no more speech recognition.
I'm new to coding, so the only reason I can think of (and I don't even know if this is the reason) is that the speech recognition directory and functions are mapped to the window.
Is there any reason for why this is happening/is there a fix?
EDIT: Code added
public MainWindow()
{
InitializeComponent();
Loaded += MainWindow_Loaded;
}
private void MainWindow_Loaded(object sender, EventArgs e)
{
_recognizer.SetInputToDefaultAudioDevice();
_recognizer.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(File.ReadAllLines(@"C:\users\username\Documents\commands.txt")))));
_recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(_recognizer_SpeechRecognized);
_recognizer.RecognizeAsync(RecognizeMode.Multiple);
}
void _recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
int ranNum = rnd.Next(1, 10);
string speech = e.Result.Text;
switch (speech)
{
//INTERACTIONS
case "hello":
...and so on