예제 #1
0
        public void SetToConfig(int cardId)
        {
            ExternalChannelConfig config = TV3BlasterPlugin.GetExternalChannelConfig(cardId);

            config.CardId = cardId;

            config.PauseTime             = Decimal.ToInt32(numericUpDownPauseTime.Value);
            config.SendSelect            = checkBoxSendSelect.Checked;
            config.DoubleChannelSelect   = checkBoxDoubleSelect.Checked;
            config.RepeatChannelCommands = Decimal.ToInt32(numericUpDownRepeat.Value);

            int chDigits = comboBoxChDigits.SelectedIndex;

            if (chDigits > 0)
            {
                chDigits++;
            }
            config.ChannelDigits = chDigits;

            config.RepeatPauseTime     = Decimal.ToInt32(numericUpDownRepeatDelay.Value);
            config.UsePreChangeCommand = checkBoxUsePreChange.Checked;

            config.SelectCommand    = listViewExternalCommands.Items[10].SubItems[1].Text;
            config.PreChangeCommand = listViewExternalCommands.Items[11].SubItems[1].Text;

            for (int i = 0; i < 10; i++)
            {
                config.Digits[i] = listViewExternalCommands.Items[i].SubItems[1].Text;
            }
        }
예제 #2
0
        public StbSetup(int cardId)
        {
            InitializeComponent();

            _cardId = cardId;

            foreach (Card card in Card.ListAll())
            {
                if (card.IdCard == _cardId)
                {
                    labelCardName.Text = card.Name;
                    if (!card.Enabled)
                    {
                        labelCardName.Text += " (Disabled)";
                    }
                    break;
                }
            }

            // Setup commands combo box
            comboBoxCommands.Items.Add(Common.UITextRun);
            comboBoxCommands.Items.Add(Common.UITextSerial);
            comboBoxCommands.Items.Add(Common.UITextWindowMsg);
            comboBoxCommands.Items.Add(Common.UITextTcpMsg);
            comboBoxCommands.Items.Add(Common.UITextHttpMsg);

            string[] fileList = TV3BlasterPlugin.GetFileList(true);
            if (fileList != null)
            {
                comboBoxCommands.Items.AddRange(fileList);
            }

            comboBoxCommands.SelectedIndex = 0;

            // Setup command list
            ListViewItem item;

            string[] subItems = new string[2];
            for (int i = 0; i < 10; i++)
            {
                subItems[0] = "Digit " + i;
                subItems[1] = String.Empty;
                item        = new ListViewItem(subItems);
                listViewExternalCommands.Items.Add(item);
            }

            subItems[0] = "Select";
            subItems[1] = String.Empty;
            item        = new ListViewItem(subItems);
            listViewExternalCommands.Items.Add(item);

            subItems[0] = "PreChange";
            subItems[1] = String.Empty;
            item        = new ListViewItem(subItems);
            listViewExternalCommands.Items.Add(item);

            SetToCard(_cardId);
        }
예제 #3
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (StbSetup setup in _tvCardStbSetups)
                {
                    setup.Save();
                    TV3BlasterPlugin.GetExternalChannelConfig(setup.CardId).Save();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Failed to save external channel setup", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }

            DialogResult = DialogResult.OK;
            Close();
        }
예제 #4
0
        public void SetToCard(int cardId)
        {
            ExternalChannelConfig config = TV3BlasterPlugin.GetExternalChannelConfig(cardId);

            if (config == null)
            {
                MessageBox.Show(this, "You must save your card configurations before copying between card setups",
                                "No saved configration to copy from", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Setup command list.
            for (int i = 0; i < 10; i++)
            {
                listViewExternalCommands.Items[i].SubItems[1].Text = config.Digits[i];
            }

            listViewExternalCommands.Items[10].SubItems[1].Text = config.SelectCommand;
            listViewExternalCommands.Items[11].SubItems[1].Text = config.PreChangeCommand;

            // Setup options.
            numericUpDownPauseTime.Value = config.PauseTime;
            checkBoxSendSelect.Checked   = config.SendSelect;
            checkBoxDoubleSelect.Checked = config.DoubleChannelSelect;
            numericUpDownRepeat.Value    = config.RepeatChannelCommands;

            checkBoxDoubleSelect.Enabled = checkBoxSendSelect.Checked;

            int channelDigitsSelect = config.ChannelDigits;

            if (channelDigitsSelect > 0)
            {
                channelDigitsSelect--;
            }
            comboBoxChDigits.SelectedIndex = channelDigitsSelect;

            checkBoxUsePreChange.Checked   = config.UsePreChangeCommand;
            numericUpDownRepeatDelay.Value = new Decimal(config.RepeatPauseTime);
        }
예제 #5
0
        private void buttonTest_Click(object sender, EventArgs e)
        {
            try
            {
                StbSetup setup = _tvCardStbSetups[tabControlTVCards.SelectedIndex];

                int    channelTest = Decimal.ToInt32(numericUpDownTest.Value);
                string channel;
                switch (setup.ChannelDigits)
                {
                case 2:
                    channel = channelTest.ToString("00");
                    break;

                case 3:
                    channel = channelTest.ToString("000");
                    break;

                case 4:
                    channel = channelTest.ToString("0000");
                    break;

                default:
                    channel = channelTest.ToString();
                    break;
                }

                int    charVal;
                string command;

                for (int repeatCount = 0; repeatCount <= setup.RepeatChannelCommands; repeatCount++)
                {
                    if (repeatCount > 0 && setup.RepeatPauseTime > 0)
                    {
                        Thread.Sleep(setup.RepeatPauseTime);
                    }

                    if (setup.UsePreChangeCommand && !String.IsNullOrEmpty(setup.PreChangeCommand))
                    {
                        TV3BlasterPlugin.ProcessExternalCommand(setup.PreChangeCommand, -1, channel);

                        if (setup.PauseTime > 0)
                        {
                            Thread.Sleep(setup.PauseTime);
                        }
                    }

                    foreach (char digit in channel)
                    {
                        charVal = digit - 48;

                        command = setup.Digits[charVal];
                        if (!String.IsNullOrEmpty(command))
                        {
                            TV3BlasterPlugin.ProcessExternalCommand(command, charVal, channel);

                            if (setup.PauseTime > 0)
                            {
                                Thread.Sleep(setup.PauseTime);
                            }
                        }
                    }

                    if (setup.SendSelect && !String.IsNullOrEmpty(setup.SelectCommand))
                    {
                        TV3BlasterPlugin.ProcessExternalCommand(setup.SelectCommand, -1, channel);

                        if (setup.DoubleChannelSelect)
                        {
                            if (setup.PauseTime > 0)
                            {
                                Thread.Sleep(setup.PauseTime);
                            }

                            TV3BlasterPlugin.ProcessExternalCommand(setup.SelectCommand, -1, channel);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Failed to test external channel", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }