private void ExternalChannels_Load(object sender, EventArgs e) { _tvCardStbSetup = new StbSetup(0); _tvCardStbSetup.Name = "StbSetup"; _tvCardStbSetup.Dock = DockStyle.Fill; _tvCardTab = new TabPage("STB"); _tvCardTab.Controls.Add(_tvCardStbSetup); tabControlTVCards.TabPages.Add(_tvCardTab); // 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) { _tvCardStbSetup = new StbSetup(0); _tvCardStbSetup.Name = "StbSetup"; _tvCardStbSetup.Dock = DockStyle.Fill; _tvCardTab = new TabPage("STB"); _tvCardTab.Controls.Add(_tvCardStbSetup); tabControlTVCards.TabPages.Add(_tvCardTab); // 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 buttonTest_Click(object sender, EventArgs e) { try { StbSetup setup = _tvCardStbSetup; 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)) { Tray.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)) { Tray.ProcessExternalCommand(command, charVal, channel); if (setup.PauseTime > 0) { Thread.Sleep(setup.PauseTime); } } } if (setup.SendSelect && !String.IsNullOrEmpty(setup.SelectCommand)) { Tray.ProcessExternalCommand(setup.SelectCommand, -1, channel); if (setup.DoubleChannelSelect) { if (setup.PauseTime > 0) { Thread.Sleep(setup.PauseTime); } Tray.ProcessExternalCommand(setup.SelectCommand, -1, channel); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Failed to test external channel", MessageBoxButtons.OK, MessageBoxIcon.Error); } }