public FaceHandler(mainScreen mainFrame) { myTimer = new System.Timers.Timer(mainFrame.theSettings.msRefresh); //remember: 1000 miliseconds in 1 second myTimer.Elapsed += new ElapsedEventHandler(IncrementEvent); //initialize dat shit this.mainFrame = mainFrame; this.lastFrameThresh = false; this.threshCntr = 0; //start the timer in main program, probably right after this is initialized }
/// <summary> /// Constructs VoiceHandler Object /// </summary> public VoiceHandler(mainScreen mainFrame) { //reference to the main program this.mainFrame = mainFrame; //prep for keeping track of the time-out myTimer = new System.Timers.Timer(REFRESHRATE); //remember: 1000 miliseconds in 1 second myTimer.Elapsed += new ElapsedEventHandler(IncrementEvent); //prep the timer for the video recording length recordingLimTimer = new System.Timers.Timer(timeOutRecording); recordingLimTimer.Elapsed += new ElapsedEventHandler(KillRecordingLimit); recordingLimTimer.Enabled = false; this.clockTimeOut = 0; //initialize the system that will handle voice recognition compEars = new SpeechRecognitionEngine(); //set audio device specified elsewhere compEars.SetInputToDefaultAudioDevice(); compEars.LoadGrammar(initGrammar()); //add the event handler compEars.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sr_SpeechRecognized); //stop listening...which may or may not be started when constructed this.Stop(); }