/// <summary> /// Keeps reading from device for duration. /// </summary> /// <param name="reader">reader to read from</param> /// <param name="second">duration to read</param> public TimedEmotivReader(IConnectomeReader <IEmotivState> reader, int second) { this.reader = reader; timer = new Timer(1000 * second); timer.Elapsed += (o, e) => reader.StopReading(); }
/// <summary> /// Insures reader is disabled /// </summary> void OnApplicationQuit() { if (Reader != null && Reader.IsReading) { Reader.StopReading(); } }
public void StopReading() { reader.StopReading(); timer.Stop(); }