Beispiel #1
0
        private void Stop()
        {
            if (!IsStarted)
            {
                return;
            }

            _timer.Stop();
            _updateSlowly.ForEach(t => t.Dispose());
            _updateSlowly.Clear();
            _updateEveryFrame.ForEach(t => t.Dispose());
            _updateEveryFrame.Clear();
            Target = null;

            Profile?.Reset();
            HeliosBinding.BindingTracer = _previousTracer;
            _previousTracer             = null;
            _timer = null;
        }
Beispiel #2
0
        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();
        }