public RadioPanelKnobAJS37(int group, int mask, bool isOn, RadioPanelPZ69KnobsAJS37 radioPanelPZ69Knob)
 {
     Group = group;
     Mask  = mask;
     IsOn  = isOn;
     RadioPanelPZ69Knob = radioPanelPZ69Knob;
 }
 public void ImportString(string str)
 {
     if (string.IsNullOrEmpty(str))
     {
         throw new ArgumentException("Import string empty. (RadioPanelKnob)");
     }
     if (!str.StartsWith("RadioPanelKnob{") || !str.EndsWith("}"))
     {
         throw new ArgumentException("Import string format exception. (RadioPanelKnob) >" + str + "<");
     }
     //RadioPanelKnob{SWITCHKEY_MASTER_ALT}
     var dataString = str.Remove(0, 15);
     //SWITCHKEY_MASTER_ALT}
     dataString = dataString.Remove(dataString.Length - 1, 1);
     //SWITCHKEY_MASTER_ALT
     RadioPanelPZ69Knob = (RadioPanelPZ69KnobsAJS37)Enum.Parse(typeof(RadioPanelPZ69KnobsAJS37), dataString.Trim());
 }
Example #3
0
        private void SendFrequencyToDCSBIOS(RadioPanelPZ69KnobsAJS37 knob)
        {
            try
            {
                if (IgnoreSwitchButtonOnce() && (knob == RadioPanelPZ69KnobsAJS37.UPPER_FREQ_SWITCH || knob == RadioPanelPZ69KnobsAJS37.LOWER_FREQ_SWITCH))
                {
                    //Don't do anything on the very first button press as the panel sends ALL
                    //switches when it is manipulated the first time
                    //This would cause unintended sync.
                    return;
                }
                if (!DataHasBeenReceivedFromDCSBIOS)
                {
                    //Don't start communication with DCS-BIOS before we have had a first contact from "them"
                    return;
                }
                switch (knob)
                {
                case RadioPanelPZ69KnobsAJS37.UPPER_FREQ_SWITCH:
                {
                    switch (_currentUpperRadioMode)
                    {
                    case CurrentAJS37RadioMode.FR22:
                    {
                        break;
                    }

                    case CurrentAJS37RadioMode.FR24:
                    {
                        break;
                    }

                    case CurrentAJS37RadioMode.TILS:
                    {
                        DCSBIOS.Send(TILS_CHANNEL_LAYER_DIAL_COMMAND_TOGGLE);
                        break;
                    }

                    case CurrentAJS37RadioMode.NOUSE:
                    {
                        break;
                    }
                    }
                    break;
                }

                case RadioPanelPZ69KnobsAJS37.LOWER_FREQ_SWITCH:
                {
                    switch (_currentLowerRadioMode)
                    {
                    case CurrentAJS37RadioMode.FR22:
                    {
                        break;
                    }

                    case CurrentAJS37RadioMode.FR24:
                    {
                        break;
                    }

                    case CurrentAJS37RadioMode.TILS:
                    {
                        DCSBIOS.Send(TILS_CHANNEL_LAYER_DIAL_COMMAND_TOGGLE);
                        break;
                    }

                    case CurrentAJS37RadioMode.NOUSE:
                    {
                        break;
                    }
                    }
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                Common.ShowErrorMessageBox(ex);
            }
        }
        private void SendFrequencyToDCSBIOS(RadioPanelPZ69KnobsAJS37 knob)
        {
            try
            {
                if (IgnoreSwitchButtonOnce() && (knob == RadioPanelPZ69KnobsAJS37.UPPER_FREQ_SWITCH || knob == RadioPanelPZ69KnobsAJS37.LOWER_FREQ_SWITCH))
                {
                    //Don't do anything on the very first button press as the panel sends ALL
                    //switches when it is manipulated the first time
                    //This would cause unintended sync.
                    return;
                }
                Common.DebugP("Entering AJS-37 Radio SendFrequencyToDCSBIOS()");
                if (!DataHasBeenReceivedFromDCSBIOS)
                {
                    //Don't start communication with DCS-BIOS before we have had a first contact from "them"
                    return;
                }
                switch (knob)
                {
                case RadioPanelPZ69KnobsAJS37.UPPER_FREQ_SWITCH:
                {
                    switch (_currentUpperRadioMode)
                    {
                    case CurrentAJS37RadioMode.FR22:
                    {
                        break;
                    }

                    case CurrentAJS37RadioMode.FR24:
                    {
                        break;
                    }

                    case CurrentAJS37RadioMode.TILS:
                    {
                        DCSBIOS.Send(TILSChannelLayerDialCommandToggle);
                        break;
                    }

                    case CurrentAJS37RadioMode.NOUSE:
                    {
                        break;
                    }
                    }
                    break;
                }

                case RadioPanelPZ69KnobsAJS37.LOWER_FREQ_SWITCH:
                {
                    switch (_currentLowerRadioMode)
                    {
                    case CurrentAJS37RadioMode.FR22:
                    {
                        break;
                    }

                    case CurrentAJS37RadioMode.FR24:
                    {
                        break;
                    }

                    case CurrentAJS37RadioMode.TILS:
                    {
                        DCSBIOS.Send(TILSChannelLayerDialCommandToggle);
                        break;
                    }

                    case CurrentAJS37RadioMode.NOUSE:
                    {
                        break;
                    }
                    }
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                Common.LogError(78002, ex);
            }
            Common.DebugP("Leaving AJS-37 Radio SendFrequencyToDCSBIOS()");
        }