Пример #1
0
        public MarathonForm()
        {
            AutoScaleDimensions = new SizeF(6F, 13F);
            AutoScaleMode       = AutoScaleMode.Font;
            FormBorderStyle     = FormBorderStyle.None;
            WindowState         = FormWindowState.Maximized;

            Name = "Marathon des millions";

            // Rajout des choix à la grammaire du prog
            var grammar = new GrammarBuilder();

            grammar.Append(new Choices("1", "2", "3", "4", "Yes", "No"));

            recognizer = new SpeechRecognitionEngine();
            recognizer.SetInputToDefaultAudioDevice();
            recognizer.UnloadAllGrammars();
            recognizer.LoadGrammar(new Grammar(grammar));
            recognizer.SpeechRecognized  += SpeechRecognized;
            recognizer.AudioLevelUpdated += AudioLevelUpdated;
            recognizer.RecognizeAsync(RecognizeMode.Multiple);

            // create a new instance of the Wiimote
            wm = new Wiimote();

            scorePanel    = new ScorePanel();
            gamePanel     = new GamePanel(wm);
            questionPanel = new QuestionPanel(gamePanel);

            // setup the event to handle state changes
            wm.WiimoteChanged += WiimoteChanged;

            // setup the event to handle insertion/removal of extensions
            wm.WiimoteExtensionChanged += WiimoteExtensionChanged;

            // connect to the Wiimote
            wm.Connect();

            // set the report type to return the IR sensor and accelerometer data (buttons always come back)
            wm.SetReportType(InputReport.IRAccel, IRSensitivity.WiiLevel5, true);

            Layout += MarathonLayout;

            Controls.Add(questionPanel);
            Controls.Add(scorePanel);
            Controls.Add(gamePanel);

            questionPanel.Start();
        }
Пример #2
0
        public MarathonForm()
        {
            AutoScaleDimensions = new SizeF(6F, 13F);
            AutoScaleMode = AutoScaleMode.Font;
            FormBorderStyle = FormBorderStyle.None;
            WindowState = FormWindowState.Maximized;

            Name = "Marathon des millions";

            // Rajout des choix à la grammaire du prog
            var grammar = new GrammarBuilder();
            grammar.Append(new Choices("1", "2", "3", "4", "Yes", "No"));

            recognizer = new SpeechRecognitionEngine();
            recognizer.SetInputToDefaultAudioDevice();
            recognizer.UnloadAllGrammars();
            recognizer.LoadGrammar(new Grammar(grammar));
            recognizer.SpeechRecognized += SpeechRecognized;
            recognizer.AudioLevelUpdated += AudioLevelUpdated;
            recognizer.RecognizeAsync(RecognizeMode.Multiple);

            // create a new instance of the Wiimote
            wm = new Wiimote();

            scorePanel = new ScorePanel();
            gamePanel = new GamePanel(wm);
            questionPanel = new QuestionPanel(gamePanel);

            // setup the event to handle state changes
            wm.WiimoteChanged += WiimoteChanged;

            // setup the event to handle insertion/removal of extensions
            wm.WiimoteExtensionChanged += WiimoteExtensionChanged;

            // connect to the Wiimote
            wm.Connect();

            // set the report type to return the IR sensor and accelerometer data (buttons always come back)
            wm.SetReportType(InputReport.IRAccel, IRSensitivity.WiiLevel5, true);

            Layout += MarathonLayout;

            Controls.Add(questionPanel);
            Controls.Add(scorePanel);
            Controls.Add(gamePanel);

            questionPanel.Start();
        }