public AudioViewEngine(TimeSpan minorInterval, TimeSpan majorInterval, IMeterReader reader) { logger.Info("Started engine with major: {0} minor: {1}", majorInterval, minorInterval); reader.SetMinorInterval(minorInterval); reader.SetMajorInterval(majorInterval); this.listeners = new List <IMeterListener>(); this.reader = reader; this.reader.SetEngine(this); this.minorInterval = minorInterval; this.majorInterval = majorInterval; this.reader.ConnectionStatusEvent += connected => { if (ConnectionStatusEvent != null) { ConnectionStatusEvent(connected); } }; if (!reader.IsTriggerMode()) { this.secondTimer = new Timer(new TimeSpan(0, 0, 1).TotalMilliseconds); this.secondTimer.Elapsed += OnSecond; minorIntervalTimer = new IntervalTimer(minorInterval); majorIntervalTimer = new IntervalTimer(majorInterval); } }
public AudioViewEngine(TimeSpan minorInterval, TimeSpan majorInterval, IMeterReader reader) { logger.Info("Started engine with major: {0} minor: {1}", majorInterval, minorInterval); reader.SetMinorInterval(minorInterval); reader.SetMajorInterval(majorInterval); this.listeners = new List<IMeterListener>(); this.reader = reader; this.reader.SetEngine(this); this.minorInterval = minorInterval; this.majorInterval = majorInterval; this.reader.ConnectionStatusEvent += connected => { if (ConnectionStatusEvent != null) { ConnectionStatusEvent(connected); } }; if (!reader.IsTriggerMode()) { this.secondTimer = new Timer(new TimeSpan(0, 0, 1).TotalMilliseconds); this.secondTimer.Elapsed += OnSecond; this.minorTimer = new Timer(minorInterval.TotalMilliseconds); this.minorTimer.Elapsed += OnMinorInterval; this.majorTimer = new Timer(majorInterval.TotalMilliseconds); this.majorTimer.Elapsed += OnMajorInterval; } }