Example #1
0
        private double GetTimeBetweenThisFrameAndLastGoodFrame(int thisFrameId, Func <TimelineFrame, double> finder)
        {
            var lastGoodFrame = Timeline.LatestFrame(finder, thisFrameId);

            if (lastGoodFrame != null)
            {
                return(Timeline.Data[thisFrameId].Seconds - lastGoodFrame.Seconds);
            }
            return(0);
        }
Example #2
0
        public void Tick()
        {
            RightEngine.Height = Math.Max(10, ((FrameworkElement)RightEngine.Parent).ActualHeight * SystemManager.Instance.Computer.Thrust);
            LeftEngine.Height  = Math.Max(10, ((FrameworkElement)LeftEngine.Parent).ActualHeight * SystemManager.Instance.Computer.Thrust);


            SetValue(txtEngineRight, SystemManager.Instance.Computer.Thrust * 100);
            SetValue(txtEngineLeft, SystemManager.Instance.Computer.Thrust * 100);

            SetValue(OILPLeft, SystemManager.Instance.IndicatorHost.Roll.Counter.Fps);
            SetValue(OILPRight, SystemManager.Instance.IndicatorHost.Pitch.Counter.Fps);
            SetValue(OILTLeft, SystemManager.Instance.IndicatorHost.Airspeed.Counter.Fps);
            SetValue(OILTRight, SystemManager.Instance.IndicatorHost.Altitude.Counter.Fps);
            SetValue(OILQLeft, SystemManager.Instance.IndicatorHost.Compass.Counter.Fps);
            SetValue(OILQRight, SystemManager.Instance.IndicatorHost.LandingGear.Counter.Fps);

            Flaps.Height = ((FrameworkElement)Flaps.Parent).ActualHeight * SystemManager.Instance.Computer.Flaps;

            GearDownPanel.Visibility = Timeline.Gear == 1 ? Visibility.Collapsed : Visibility.Visible;
            FlapsPanel.Visibility    = SystemManager.Instance.Computer.Flaps > 0 ? Visibility.Visible : Visibility.Collapsed;

            ticks++;
            if (ticks % 10 == 0)
            {
                foreach (var kp in _warnings)
                {
                    var lastValue = Timeline.LatestFrame(kp.Value, Timeline.LatestFrameId);
                    if (lastValue != null)
                    {
                        var dt = Timeline.Duration.Elapsed.TotalSeconds - lastValue.Seconds;
                        if (dt > 1)
                        {
                            if (!Warnings.Contains(kp.Key))
                            {
                                Warnings.Add(kp.Key);
                            }
                        }
                        else
                        {
                            if (Warnings.Contains(kp.Key))
                            {
                                Warnings.Remove(kp.Key);
                            }
                        }
                    }
                    else
                    {
                        if (!Warnings.Contains(kp.Key))
                        {
                            Warnings.Add(kp.Key);
                        }
                    }
                }
            }
        }