本文整理汇总了C#中TvDatabase.TvBusinessLayer.GetTuningDetailsByName方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.GetTuningDetailsByName方法的具体用法?C# TvBusinessLayer.GetTuningDetailsByName怎么用?C# TvBusinessLayer.GetTuningDetailsByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TvDatabase.TvBusinessLayer
的用法示例。
在下文中一共展示了TvBusinessLayer.GetTuningDetailsByName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: mpButton1_Click
private void mpButton1_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(_configuration.Graph.Crossbar.Name))
{
IUser user = new User();
user.CardId = _cardNumber;
AnalogChannel temp = new AnalogChannel();
temp.TunerSource = TunerInputType.Antenna;
temp.VideoSource = AnalogChannel.VideoInputType.Tuner;
temp.AudioSource = AnalogChannel.AudioInputType.Tuner;
temp.IsRadio = false;
temp.IsTv = true;
RemoteControl.Instance.Tune(ref user, temp, -1);
_configuration = Configuration.readConfiguration(_cardNumber, _cardName, _devicePath);
if (string.IsNullOrEmpty(_configuration.Graph.Crossbar.Name))
{
MessageBox.Show(this, "The S-Video channels could not be detected.");
return;
}
ReCheckSettings();
}
TvBusinessLayer layer = new TvBusinessLayer();
Dictionary<AnalogChannel.VideoInputType, int> videoPinMap = _configuration.Graph.Crossbar.VideoPinMap;
AnalogChannel tuningDetail;
Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
Channel dbChannel;
if (videoPinMap.ContainsKey(AnalogChannel.VideoInputType.VideoInput1))
{
string channelName = "CVBS#1 on " + card.IdCard;
IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channelName, 0);
if (tuningDetails != null && tuningDetails.Count > 0)
{
dbChannel = tuningDetails[0].ReferencedChannel();
}
else
{
dbChannel = layer.AddNewChannel(channelName);
}
dbChannel.IsTv = true;
dbChannel.Persist();
tuningDetail = new AnalogChannel();
tuningDetail.IsTv = true;
tuningDetail.Name = dbChannel.DisplayName;
tuningDetail.VideoSource = AnalogChannel.VideoInputType.VideoInput1;
layer.AddTuningDetails(dbChannel, tuningDetail);
layer.MapChannelToCard(card, dbChannel, false);
layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
}
if (videoPinMap.ContainsKey(AnalogChannel.VideoInputType.VideoInput2))
{
string channelName = "CVBS#2 on " + card.IdCard;
IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channelName, 0);
if (tuningDetails != null && tuningDetails.Count > 0)
{
dbChannel = tuningDetails[0].ReferencedChannel();
}
else
{
dbChannel = layer.AddNewChannel(channelName);
}
dbChannel.IsTv = true;
dbChannel.Persist();
tuningDetail = new AnalogChannel();
tuningDetail.IsTv = true;
tuningDetail.Name = dbChannel.DisplayName;
tuningDetail.VideoSource = AnalogChannel.VideoInputType.VideoInput2;
layer.AddTuningDetails(dbChannel, tuningDetail);
layer.MapChannelToCard(card, dbChannel, false);
layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
}
if (videoPinMap.ContainsKey(AnalogChannel.VideoInputType.VideoInput3))
{
string channelName = "CVBS#3 on " + card.IdCard;
IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channelName, 0);
if (tuningDetails != null && tuningDetails.Count > 0)
{
dbChannel = tuningDetails[0].ReferencedChannel();
}
else
{
dbChannel = layer.AddNewChannel(channelName);
}
dbChannel.IsTv = true;
dbChannel.Persist();
tuningDetail = new AnalogChannel();
tuningDetail.IsTv = true;
tuningDetail.Name = dbChannel.DisplayName;
tuningDetail.VideoSource = AnalogChannel.VideoInputType.VideoInput3;
layer.AddTuningDetails(dbChannel, tuningDetail);
layer.MapChannelToCard(card, dbChannel, false);
layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
}
if (videoPinMap.ContainsKey(AnalogChannel.VideoInputType.SvhsInput1))
{
string channelName = "S-Video#1 on " + card.IdCard;
IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channelName, 0);
if (tuningDetails != null && tuningDetails.Count > 0)
{
dbChannel = tuningDetails[0].ReferencedChannel();
//.........这里部分代码省略.........
示例2: DoTvScan
//.........这里部分代码省略.........
string line = String.Format("channel:{0} source:{1} ", channel.ChannelNumber, mpComboBoxSource.SelectedItem);
ListViewItem item = mpListView1.Items.Add(new ListViewItem(line));
item.EnsureVisible();
IChannel[] channels = RemoteControl.Instance.Scan(_cardNumber, channel);
UpdateStatus();
if (channels == null || channels.Length == 0)
{
if (RemoteControl.Instance.TunerLocked(_cardNumber) == false)
{
line = String.Format("channel:{0} source:{1} : No Signal", channel.ChannelNumber,
mpComboBoxSource.SelectedItem);
item.Text = line;
item.ForeColor = Color.Red;
continue;
}
line = String.Format("channel:{0} source:{1} : Nothing found", channel.ChannelNumber,
mpComboBoxSource.SelectedItem);
item.Text = line;
item.ForeColor = Color.Red;
continue;
}
bool exists = false;
channel = (AnalogChannel)channels[0];
if (channel.Name == "")
channel.Name = String.Format(channel.ChannelNumber.ToString());
Channel dbChannel = null;
if (checkBoxNoMerge.Checked)
{
dbChannel = layer.AddNewChannel(channel.Name);
}
else
{
IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channel.Name, 0);
if (tuningDetails != null && tuningDetails.Count > 0)
{
dbChannel = tuningDetails[0].ReferencedChannel();
}
if (dbChannel != null)
{
exists = true;
}
else
{
dbChannel = layer.AddNewChannel(channel.Name);
}
}
dbChannel.IsTv = channel.IsTv;
dbChannel.IsRadio = channel.IsRadio;
dbChannel.Persist();
layer.AddTuningDetails(dbChannel, channel);
layer.MapChannelToCard(card, dbChannel, false);
if (dbChannel.IsTv)
{
layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
if (checkBoxCreateSignalGroup.Checked)
{
layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.Analog);
}
}
if (dbChannel.IsRadio)
{
layer.AddChannelToGroup(dbChannel, TvConstants.RadioGroupNames.AllChannels);
if (checkBoxCreateSignalGroup.Checked)
示例3: DoRadioScan
private void DoRadioScan()
{
int channelsNew = 0;
int channelsUpdated = 0;
checkButton.Enabled = false;
int sensitivity = 1;
switch (mpComboBoxSensitivity.Text)
{
case "High":
sensitivity = 10;
break;
case "Medium":
sensitivity = 2;
break;
case "Low":
sensitivity = 1;
break;
}
string buttonText = mpButtonScanRadio.Text;
try
{
_isScanning = true;
_stopScanning = false;
mpButtonScanRadio.Text = "Cancel...";
RemoteControl.Instance.EpgGrabberEnabled = false;
TvBusinessLayer layer = new TvBusinessLayer();
Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
mpComboBoxCountry.Enabled = false;
mpComboBoxSource.Enabled = false;
mpComboBoxSensitivity.Enabled = false;
checkBoxCreateSignalGroup.Enabled = false;
checkBoxNoMerge.Enabled = false;
mpButtonScanTv.Enabled = false;
mpButtonAddSvideoChannels.Enabled = false;
UpdateStatus();
mpListView1.Items.Clear();
CountryCollection countries = new CountryCollection();
for (int freq = 87500000; freq < 108000000; freq += 100000)
{
if (_stopScanning)
return;
float percent = ((freq - 87500000)) / (108000000f - 87500000f);
percent *= 100f;
if (percent > 100f)
percent = 100f;
progressBar1.Value = (int)percent;
AnalogChannel channel = new AnalogChannel();
channel.IsRadio = true;
channel.TunerSource = mpComboBoxSource.SelectedIndex == 0 ? TunerInputType.Antenna : TunerInputType.Cable;
channel.VideoSource = AnalogChannel.VideoInputType.Tuner;
channel.AudioSource = AnalogChannel.AudioInputType.Automatic;
channel.Country = countries.Countries[mpComboBoxCountry.SelectedIndex];
channel.Frequency = freq;
channel.IsTv = false;
channel.IsRadio = true;
float freqMHz = channel.Frequency;
freqMHz /= 1000000f;
string line = String.Format("frequence:{0} MHz ", freqMHz.ToString("f2"));
ListViewItem item = mpListView1.Items.Add(new ListViewItem(line));
item.EnsureVisible();
IUser user = new User();
user.CardId = _cardNumber;
TvResult tuneResult = RemoteControl.Instance.Tune(ref user, channel, -1);
if (tuneResult == TvResult.SWEncoderMissing)
{
Log.Error("analog: DoTvScan error (missing software encoder)");
MessageBox.Show("Please install a supported audio/video encoder for your software analog card",
"Unable to scan", MessageBoxButtons.OK, MessageBoxIcon.Error);
break;
}
if (tuneResult == TvResult.GraphBuildingFailed)
{
Log.Error("analog: DoTvScan error (missing software encoder)");
MessageBox.Show(
"The graph building. Mostly your card is not supported by TvServer. Please create a report in our forum",
"Unable to scan", MessageBoxButtons.OK, MessageBoxIcon.Error);
break;
}
UpdateStatus();
Thread.Sleep(2000);
if (SignalStrength(sensitivity) == 100)
{
channel.Name = String.Format("{0}", freq);
Channel dbChannel = null;
IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channel.Name, 0);
if (tuningDetails != null && tuningDetails.Count > 0)
{
dbChannel = tuningDetails[0].ReferencedChannel();
}
if (dbChannel != null)
{
line = String.Format("frequence:{0} MHz : Channel update found - {1}", freqMHz.ToString("f2"),
channel.Name);
channelsUpdated++;
}
else
{
dbChannel = layer.AddNewChannel(channel.Name);
line = String.Format("frequence:{0} MHz : New channel found - {1}", freqMHz.ToString("f2"), channel.Name);
//.........这里部分代码省略.........