private async void FlightConnector_GenericValuesUpdated(object sender, ToggleValueUpdatedEventArgs e)
        {
            bool isUpdated = false;

            if (e.GenericValueStatus.ContainsKey(bankValue) && lastRawBank != e.GenericValueStatus[bankValue])
            {
                lastRawBank = e.GenericValueStatus[bankValue];
                float.TryParse(lastRawBank, out currentBankValue);
                isUpdated = true;
            }
            if (e.GenericValueStatus.ContainsKey(headingValue) && lastRawHeading != e.GenericValueStatus[headingValue])
            {
                lastRawHeading = e.GenericValueStatus[headingValue];
                float.TryParse(lastRawHeading, out currentHeadingValue);
                isUpdated = true;
            }
            if (e.GenericValueStatus.ContainsKey(pitchValue) && lastRawPitch != e.GenericValueStatus[pitchValue])
            {
                lastRawPitch = e.GenericValueStatus[pitchValue];
                float.TryParse(lastRawPitch, out currentPitchValue);
                isUpdated = true;
            }

            if (isUpdated)
            {
                await UpdateImage();
            }
        }
Пример #2
0
        private async void FlightConnector_GenericValuesUpdated(object?sender, ToggleValueUpdatedEventArgs e)
        {
            bool isUpdated = false;

            if (e.GenericValueStatus.ContainsKey((bankValue, null)) && currentBankValue != e.GenericValueStatus[(bankValue, null)])
            {
                currentBankValue = e.GenericValueStatus[(bankValue, null)];
Пример #3
0
        private async void FlightConnector_GenericValuesUpdated(object sender, ToggleValueUpdatedEventArgs e)
        {
            if (StreamDeck == null)
            {
                return;
            }

            bool isUpdated = false;

            if (displayValue.HasValue && e.GenericValueStatus.ContainsKey(displayValue.Value))
            {
                float.TryParse(e.GenericValueStatus[displayValue.Value], out float newValue);
                isUpdated    = currentValue != newValue;
                currentValue = newValue;
            }
            if (displayValueBottom.HasValue && e.GenericValueStatus.ContainsKey(displayValueBottom.Value))
            {
                float.TryParse(e.GenericValueStatus[displayValueBottom.Value], out float newValue);
                isUpdated         |= currentValueBottom != newValue;
                currentValueBottom = newValue;
            }
            if (subDisplayValue.HasValue && e.GenericValueStatus.ContainsKey(subDisplayValue.Value))
            {
                float.TryParse(e.GenericValueStatus[subDisplayValue.Value], out float newValue);
                isUpdated      |= currentSubValue != newValue;
                currentSubValue = newValue;
            }

            if (isUpdated)
            {
                await UpdateImage();
            }
        }
        private async void FlightConnector_GenericValuesUpdated(object sender, ToggleValueUpdatedEventArgs e)
        {
            if (StreamDeck == null)
            {
                return;
            }

            var newStatus = expression != null && evaluator.Evaluate(e.GenericValueStatus, expression);
            var isUpdated = newStatus != currentStatus;

            currentStatus = newStatus;

            if (displayValue.HasValue && e.GenericValueStatus.ContainsKey(displayValue.Value))
            {
                string newValue = e.GenericValueStatus[displayValue.Value];
                isUpdated   |= newValue != currentValue;
                currentValue = newValue;
            }

            if (toggleEventDataVariable.HasValue && e.GenericValueStatus.ContainsKey(toggleEventDataVariable.Value))
            {
                toggleEventDataVariableValue = e.GenericValueStatus[toggleEventDataVariable.Value];
            }

            if (isUpdated)
            {
                await UpdateImage();
            }
        }
        private async void FlightConnector_GenericValuesUpdated(object sender, ToggleValueUpdatedEventArgs e)
        {
            if (StreamDeck == null)
            {
                return;
            }

            bool isUpdated = false;

            if (feedbackValue.HasValue && e.GenericValueStatus.ContainsKey(feedbackValue.Value))
            {
                bool newStatus = e.GenericValueStatus[feedbackValue.Value] != "0";
                isUpdated     = newStatus != currentStatus;
                currentStatus = newStatus;
            }
            if (displayValue.HasValue && e.GenericValueStatus.ContainsKey(displayValue.Value))
            {
                string newValue = e.GenericValueStatus[displayValue.Value];
                isUpdated   |= newValue != currentValue;
                currentValue = newValue;
            }

            if (isUpdated)
            {
                await UpdateImage();
            }
        }
        private async void FlightConnector_GenericValuesUpdated(object sender, ToggleValueUpdatedEventArgs e)
        {
            if (StreamDeck == null)
            {
                return;
            }

            bool isUpdated = false;

            if (displayValue.HasValue && e.GenericValueStatus.ContainsKey(displayValue.Value))
            {
                float newValue = 0;
                float.TryParse(e.GenericValueStatus[displayValue.Value], out newValue);
                isUpdated = currentValue != newValue;
                if (displayValue.Value == TOGGLE_VALUE.ELEVATOR_TRIM_POSITION)
                {
                    newValue = newValue * -1;
                }
                currentValue = newValue;
            }

            if (isUpdated)
            {
                await UpdateImage();
            }
        }
Пример #7
0
        private async void FlightConnector_GenericValuesUpdated(object sender, ToggleValueUpdatedEventArgs e)
        {
            if (StreamDeck == null)
            {
                return;
            }

            var valuesWithDefaultUnits = e.GenericValueStatus.Where(o => o.Key.unit == null).ToDictionary(o => o.Key.variable, o => o.Value);
            var newStatus = expression != null && evaluator.Evaluate(valuesWithDefaultUnits, expression);
            var isUpdated = newStatus != currentStatus;

            currentStatus = newStatus;

            if (displayValue.HasValue && e.GenericValueStatus.ContainsKey((displayValue.Value, customUnit)))
            {
                var newValue = e.GenericValueStatus[(displayValue.Value, customUnit)];
        private async void FlightConnector_GenericValuesUpdated(object sender, ToggleValueUpdatedEventArgs e)
        {
            bool isUpdated = false;

            if (e.GenericValueStatus.ContainsKey(displayValue.Value))
            {
                float newValue = 0;
                float.TryParse(e.GenericValueStatus[displayValue.Value], out newValue);
                isUpdated    = currentValue != newValue;
                currentValue = newValue;
            }

            if (isUpdated)
            {
                await UpdateImage();
            }
        }