private void Update(TesterBase tester, DateTime now, TimeSpan elapsed) { string testValue = tester.Update(now, elapsed); if (testValue == null) { // nothing to do right now return; } if (!Target.DispatchReceived(tester.Data.ID, testValue)) { Logger.Warn("failed to dispatch value {Value} synthesized for id {Id} in DCS interface being tested", testValue, tester.Data.ID); } }
private void Start() { _updateEveryFrame = new List <TesterBase>(); _updateSlowly = new List <TesterBase>(); if (Profile == null) { return; } Target = Profile.Interfaces.OfType <DCSInterface>().FirstOrDefault(); if (Target == null) { return; } _timer = new DispatcherTimer(TimeSpan.FromSeconds(1d / UPDATES_PER_SECOND), DispatcherPriority.DataBind, Tick, System.Windows.Application.Current.Dispatcher); _previousTracer = HeliosBinding.BindingTracer; HeliosBinding.BindingTracer = new SoftLoopTracer(); foreach (NetworkFunction networkFunction in Target.Functions) { foreach (DCSDataElement dataElement in networkFunction.GetDataElements().OfType <DCSDataElement>()) { TesterBase tester = CreateTester(networkFunction, dataElement); if (dataElement.IsExportedEveryFrame) { _updateEveryFrame.Add(tester); } else { _updateSlowly.Add(tester); } } } _lastTime = DateTime.Now; _timer.Start(); }