Example #1
0
        public static void HideDCSBIOSDecoders(DCSBIOSDecoder dcsbiosDecoder, string layerName, string bindingHash)
        {
            var eventArgs = new StreamDeckHideDecoderEventArgs();

            eventArgs.BindingHash          = bindingHash;
            eventArgs.StreamDeckButtonName = dcsbiosDecoder.StreamDeckButtonName;
            eventArgs.LayerName            = layerName;
            OnStreamDeckHideDecodersEventHandler?.Invoke(dcsbiosDecoder, eventArgs);
        }
Example #2
0
        public StreamDeckDCSBIOSDecoderWindow(DCSBIOSDecoder dcsbiosDecoder, StreamDeckPanel streamDeckPanel)
        {
            InitializeComponent();
            _dcsbiosDecoder = dcsbiosDecoder;
            DCSBIOSControlLocator.LoadControls();
            _dcsbiosControls = DCSBIOSControlLocator.GetIntegerOutputControls();
            _streamDeckPanel = streamDeckPanel;

            BIOSEventHandler.AttachDataListener(this);
        }
        public StreamDeckDCSBIOSDecoderWindow(DCSBIOSDecoder dcsbiosDecoder, StreamDeckPanel streamDeckPanel)
        {
            InitializeComponent();
            _dcsbiosDecoder = dcsbiosDecoder;
            DCSBIOSControlLocator.LoadControls();
            _dcsbiosControls = DCSBIOSControlLocator.GetIntegerOutputControls();
            _streamDeckPanel = streamDeckPanel;
            var thread = new Thread(ThreadLoop);

            thread.Start();
        }
        private void ShowDecoder()
        {
            _populatingData = true;

            SetInfoTextBoxes();

            DCSBIOSDecoder.ShowOnly(_dcsbiosDecoder, _streamDeckPanel);
            if (_dcsbiosDecoder.DecoderSourceType == DCSBiosOutputType.INTEGER_TYPE)
            {
                RadioButtonIntegerSource.IsChecked = true;
            }
            else if (_dcsbiosDecoder.DecoderSourceType == DCSBiosOutputType.STRING_TYPE)
            {
                RadioButtonStringSource.IsChecked = true;
            }

            switch (_dcsbiosDecoder.DecoderOutputType)
            {
            case EnumDCSBIOSDecoderOutputType.Raw:
            {
                TextBoxOutputTextRaw.Text         = _dcsbiosDecoder.ButtonTextTemplate;
                RadioButtonProcessToRaw.IsChecked = true;
                break;
            }

            case EnumDCSBIOSDecoderOutputType.Converter:
            {
                RadioButtonProcessToConverter.IsChecked = true;
                break;
            }
            }
            CheckBoxTreatStringAsNumber.IsChecked = _dcsbiosDecoder.TreatStringAsNumber;

            CheckBoxUseFormula.IsChecked = _dcsbiosDecoder.UseFormula;
            if (_dcsbiosDecoder.UseFormula)
            {
                CheckBoxUseFormula.IsChecked = true;
                TextBoxFormula.Text          = string.IsNullOrEmpty(_dcsbiosDecoder.Formula) ? "" : _dcsbiosDecoder.Formula;
            }

            if (_dcsbiosDecoder.DCSBIOSOutput != null)
            {
                TextBoxDCSBIOSId.Text = _dcsbiosDecoder.DCSBIOSOutput.ControlId;
            }



            ShowConverters();
            TextBoxFontInfo.UpdateFontInfo();
            _populatingData = false;
        }
        public StreamDeckDCSBIOSDecoderWindow(string streamDeckInstanceId, EnumStreamDeckButtonNames streamDeckButton)
        {
            InitializeComponent();
            _dcsbiosDecoder = new DCSBIOSDecoder();
            _dcsbiosDecoder.SetEssentials(streamDeckInstanceId, streamDeckButton);
            LoadDefaults();
            DCSBIOSControlLocator.LoadControls();
            _dcsbiosControls = DCSBIOSControlLocator.GetIntegerOutputControls();
            _dcsbiosDecoder.StreamDeckButtonName = streamDeckButton;
            _streamDeckInstanceId = streamDeckInstanceId;
            var thread = new Thread(ThreadLoop);

            thread.Start();
        }
Example #6
0
 public StreamDeckDCSBIOSDecoderWindow(StreamDeckPanel streamDeckPanel)
 {
     InitializeComponent();
     _streamDeckPanel = streamDeckPanel;
     _dcsbiosDecoder  = new DCSBIOSDecoder
     {
         DecoderSourceType       = DCSBiosOutputType.IntegerType,
         StreamDeckPanelInstance = streamDeckPanel,
         StreamDeckButtonName    = streamDeckPanel.SelectedButtonName
     };
     LoadDefaults();
     DCSBIOSControlLocator.LoadControls();
     _dcsbiosControls = DCSBIOSControlLocator.GetIntegerOutputControls();
     BIOSEventHandler.AttachDataListener(this);
 }
        public StreamDeckDCSBIOSDecoderWindow(string panelHash)
        {
            InitializeComponent();
            _dcsbiosDecoder = new DCSBIOSDecoder();
            _dcsbiosDecoder.DecoderSourceType = DCSBiosOutputType.INTEGER_TYPE;
            _dcsbiosDecoder.PanelHash         = panelHash;
            LoadDefaults();
            DCSBIOSControlLocator.LoadControls();
            _dcsbiosControls = DCSBIOSControlLocator.GetIntegerOutputControls();
            _dcsbiosDecoder.StreamDeckButtonName = StreamDeckPanel.GetInstance(panelHash).SelectedButtonName;
            _panelHash = panelHash;
            var thread = new Thread(ThreadLoop);

            thread.Start();
        }
Example #8
0
        public void DCSBIOSDecoder_MustBe_Clonable()
        {
            DCSBIOSDecoder source = new();

            source.ButtonFinalText    = _sringValue1;
            source.ButtonTextTemplate = _sringValue2;
            source.FontColor          = _colorValue1;

            DCSBIOSDecoder cloned = source.CloneJson();

            Assert.NotNull(cloned);
            Assert.Equal(string.Empty, cloned.ButtonFinalText); // has [JsonIgnore] attribute, no value expected in clone
            Assert.Equal(_sringValue2, cloned.ButtonTextTemplate);
            Assert.Equal(_colorValue1, cloned.FontColor);
        }
        public override void Clear()
        {
            _streamDeckTargetLayer = null;
            _bipLinkStreamDeck     = null;
            Button           = null;
            _textFont        = SettingsManager.DefaultFont;
            _fontColor       = SettingsManager.DefaultFontColor;
            _backgroundColor = SettingsManager.DefaultBackgroundColor;
            _dcsbiosDecoder  = null;
            _textFont        = SettingsManager.DefaultFont;

            if (TextBox != null)
            {
                TextBox.Background = Brushes.LightSteelBlue;
                TextBox.Text       = "";
            }
            _imageFileRelativePath = "";
        }
Example #10
0
 public static void DetachDCSBIOSDecoder(DCSBIOSDecoder dcsbiosDecoder)
 {
     OnStreamDeckHideDecodersEventHandler -= dcsbiosDecoder.HideAllEvent;
 }
 public void SetDecoder(DCSBIOSDecoder dcsbiosDecoder)
 {
     TextBoxDCSBIOSDecoder.Bill.DCSBIOSDecoder = dcsbiosDecoder;
 }
Example #12
0
        private void ShowDecoder()
        {
            _populatingData = true;

            SetInfoTextBoxes();

            DCSBIOSDecoder.ShowOnly(_dcsbiosDecoder, _streamDeckPanel);
            if (_dcsbiosDecoder.DecoderSourceType == DCSBiosOutputType.IntegerType)
            {
                RadioButtonIntegerSource.IsChecked = true;
            }
            else if (_dcsbiosDecoder.DecoderSourceType == DCSBiosOutputType.StringType)
            {
                RadioButtonStringSource.IsChecked = true;
            }

            switch (_dcsbiosDecoder.DecoderOutputType)
            {
            case EnumDCSBIOSDecoderOutputType.Raw:
            {
                TextBoxOutputTextRaw.Text         = _dcsbiosDecoder.ButtonTextTemplate;
                RadioButtonProcessToRaw.IsChecked = true;
                break;
            }

            case EnumDCSBIOSDecoderOutputType.Converter:
            {
                RadioButtonProcessToConverter.IsChecked = true;
                break;
            }
            }
            CheckBoxTreatStringAsNumber.IsChecked = _dcsbiosDecoder.TreatStringAsNumber;

            CheckBoxUseFormula.IsChecked = _dcsbiosDecoder.UseFormula;
            if (_dcsbiosDecoder.UseFormula && _dcsbiosDecoder.FormulaInstance != null)
            {
                CheckBoxUseFormula.IsChecked = true;

                TextBoxFormula.Text = string.IsNullOrEmpty(_dcsbiosDecoder.FormulaInstance.Formula) ? string.Empty : _dcsbiosDecoder.FormulaInstance.Formula;

                if (_dcsbiosDecoder.LimitDecimalPlaces && _dcsbiosDecoder.NumberFormatInfoFormula != null)
                {
                    CheckBoxLimitDecimals.Checked   -= CheckBoxLimitDecimals_CheckedChanged;
                    CheckBoxLimitDecimals.Unchecked -= CheckBoxLimitDecimals_CheckedChanged;
                    CheckBoxLimitDecimals.IsChecked  = _dcsbiosDecoder.LimitDecimalPlaces;
                    CheckBoxLimitDecimals.Checked   += CheckBoxLimitDecimals_CheckedChanged;
                    CheckBoxLimitDecimals.Unchecked += CheckBoxLimitDecimals_CheckedChanged;

                    ComboBoxDecimals.SelectionChanged -= ComboBoxDecimals_OnSelectionChanged;
                    ComboBoxDecimals.SelectedIndex     = _dcsbiosDecoder.NumberFormatInfoFormula.NumberDecimalDigits;
                    ComboBoxDecimals.SelectionChanged += ComboBoxDecimals_OnSelectionChanged;
                }
            }

            if (_dcsbiosDecoder.DCSBIOSOutput != null)
            {
                TextBoxDCSBIOSId.Text = _dcsbiosDecoder.DCSBIOSOutput.ControlId;
            }

            ShowConverters();
            TextBoxFontInfo.UpdateFontInfo();
            _populatingData = false;
        }