本文整理汇总了C#中PlayList.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# PlayList.GetEnumerator方法的具体用法?C# PlayList.GetEnumerator怎么用?C# PlayList.GetEnumerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayList
的用法示例。
在下文中一共展示了PlayList.GetEnumerator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoScan
private void DoScan()
{
int tvChannelsNew = 0;
int radioChannelsNew = 0;
int tvChannelsUpdated = 0;
int radioChannelsUpdated = 0;
string buttonText = mpButtonScanTv.Text;
IUser user = new User();
user.CardId = _cardNumber;
try
{
// First lock the card, because so that other parts of a hybrid card can't be used at the same time
_isScanning = true;
_stopScanning = false;
mpButtonScanTv.Text = "Cancel...";
RemoteControl.Instance.EpgGrabberEnabled = false;
listViewStatus.Items.Clear();
PlayList playlist = new PlayList();
if (mpComboBoxService.SelectedIndex == 0)
{
//TODO read SAP announcements
}
else
{
IPlayListIO playlistIO =
PlayListFactory.CreateIO(String.Format(@"{0}\TuningParameters\dvbip\{1}.m3u", PathManager.GetDataPath,
mpComboBoxService.SelectedItem));
playlistIO.Load(playlist,
String.Format(@"{0}\TuningParameters\dvbip\{1}.m3u", PathManager.GetDataPath,
mpComboBoxService.SelectedItem));
}
if (playlist.Count == 0) return;
mpComboBoxService.Enabled = false;
checkBoxCreateGroups.Enabled = false;
checkBoxEnableChannelMoveDetection.Enabled = false;
TvBusinessLayer layer = new TvBusinessLayer();
Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
int index = -1;
IEnumerator<PlayListItem> enumerator = playlist.GetEnumerator();
while (enumerator.MoveNext())
{
if (_stopScanning) return;
index++;
float percent = ((float)(index)) / playlist.Count;
percent *= 100f;
if (percent > 100f) percent = 100f;
progressBar1.Value = (int)percent;
string url = enumerator.Current.FileName.Substring(enumerator.Current.FileName.LastIndexOf('\\') + 1);
string name = enumerator.Current.Description;
DVBIPChannel tuneChannel = new DVBIPChannel();
tuneChannel.Url = url;
tuneChannel.Name = name;
string line = String.Format("{0}- {1} - {2}", 1 + index, tuneChannel.Name, tuneChannel.Url);
ListViewItem item = listViewStatus.Items.Add(new ListViewItem(line));
item.EnsureVisible();
RemoteControl.Instance.Tune(ref user, tuneChannel, -1);
IChannel[] channels;
channels = RemoteControl.Instance.Scan(_cardNumber, tuneChannel);
UpdateStatus();
if (channels == null || channels.Length == 0)
{
if (RemoteControl.Instance.TunerLocked(_cardNumber) == false)
{
line = String.Format("{0}- {1} - {2} :No Signal", 1 + index, tuneChannel.Url, tuneChannel.Name);
item.Text = line;
item.ForeColor = Color.Red;
continue;
}
else
{
line = String.Format("{0}- {1} - {2} :Nothing found", 1 + index, tuneChannel.Url, tuneChannel.Name);
item.Text = line;
item.ForeColor = Color.Red;
continue;
}
}
int newChannels = 0;
int updatedChannels = 0;
for (int i = 0; i < channels.Length; ++i)
{
Channel dbChannel;
DVBIPChannel channel = (DVBIPChannel)channels[i];
if (channels.Length > 1)
{
if (channel.Name.IndexOf("Unknown") == 0)
{
channel.Name = name + (i + 1);
}
}
else
{
//.........这里部分代码省略.........