Пример #1
0
        private void ExternalChannels_Load(object sender, EventArgs e)
        {
            IList <Card> cards = Card.ListAll();

            if (cards.Count == 0)
            {
                Card dummyCard = new Card(0, "device path", "Dummy TV Card", 0, false, DateTime.Now, "recording folder", 0,
                                          false, 0, "timeshifting folder", 0, 0, false, false, false, 0);
                cards.Add(dummyCard);
            }

            _tvCardStbSetups = new StbSetup[cards.Count];

            comboBoxCopyFrom.Items.Clear();

            TabPage tempPage;
            int     index = 0;

            foreach (Card card in cards)
            {
                comboBoxCopyFrom.Items.Add(card.IdCard);

                _tvCardStbSetups[index]          = new StbSetup(card.IdCard);
                _tvCardStbSetups[index].Name     = String.Format("StbSetup{0}", index);
                _tvCardStbSetups[index].Dock     = DockStyle.Fill;
                _tvCardStbSetups[index].TabIndex = 0;

                tempPage = new TabPage(String.Format("TV Card {0}", index + 1));
                tempPage.Controls.Add(_tvCardStbSetups[index]);

                tabControlTVCards.TabPages.Add(tempPage);

                index++;
            }

            comboBoxCopyFrom.SelectedIndex = 0;

            // Setup quick setup combo box
            string[] quickSetupFiles = Directory.GetFiles(Common.FolderSTB, "*.xml", SearchOption.TopDirectoryOnly);
            foreach (string file in quickSetupFiles)
            {
                comboBoxQuickSetup.Items.Add(Path.GetFileNameWithoutExtension(file));
            }

            comboBoxQuickSetup.Items.Add("Clear all");
        }
    private void ExternalChannels_Load(object sender, EventArgs e)
    {
      IList<Card> cards = Card.ListAll();

      if (cards.Count == 0)
      {
        Card dummyCard = new Card(0, "device path", "Dummy TV Card", 0, false, DateTime.Now, "recording folder", 0,
                                  false, 0, "timeshifting folder", 0, 0, 0);
        cards.Add(dummyCard);
      }

      _tvCardStbSetups = new StbSetup[cards.Count];

      comboBoxCopyFrom.Items.Clear();

      TabPage tempPage;
      int index = 0;

      foreach (Card card in cards)
      {
        comboBoxCopyFrom.Items.Add(card.IdCard);

        _tvCardStbSetups[index] = new StbSetup(card.IdCard);
        _tvCardStbSetups[index].Name = String.Format("StbSetup{0}", index);
        _tvCardStbSetups[index].Dock = DockStyle.Fill;
        _tvCardStbSetups[index].TabIndex = 0;

        tempPage = new TabPage(String.Format("TV Card {0}", index + 1));
        tempPage.Controls.Add(_tvCardStbSetups[index]);

        tabControlTVCards.TabPages.Add(tempPage);

        index++;
      }

      comboBoxCopyFrom.SelectedIndex = 0;

      // Setup quick setup combo box
      string[] quickSetupFiles = Directory.GetFiles(Common.FolderSTB, "*.xml", SearchOption.TopDirectoryOnly);
      foreach (string file in quickSetupFiles)
        comboBoxQuickSetup.Items.Add(Path.GetFileNameWithoutExtension(file));

      comboBoxQuickSetup.Items.Add("Clear all");
    }
Пример #3
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);
            }
        }