[英]Windows media player play states in C#
I´m beginner in C# coding.我是 C# 编码的初学者。 Especially, when it comes to use Wmp in C#.
尤其是在 C# 中使用 Wmp 时。 I work in visual studio 2017, on a project called "station information system" for a small, private railway in our country.
我在 2017 年的 Visual Studio 工作,从事一个名为“车站信息系统”的项目,用于我们国家的一条小型私人铁路。 The whole functionality of program I´ve done correctly, it works, so now I need to come up with an idea, how to make it playing.
我已经正确完成了程序的整个功能,它可以工作,所以现在我需要想出一个想法,如何让它发挥作用。 My program exports exact names of mp3 files into a hidden listbox.
我的程序将 mp3 文件的确切名称导出到隐藏的列表框中。 To generate patches I use this code:
要生成补丁,我使用以下代码:
axWindowsMediaPlayer1.URL = Path.Combine(Environment.CurrentDirectory, @"ZVUK\\", listBox2.SelectedItem.ToString());
It works, so I came to the other functionality I need from Wmp.它有效,所以我从 Wmp 获得了我需要的其他功能。 When Wmp plays the full song, I need it to change the index in listbox and go to second song, then third and so on.
当 Wmp 播放整首歌曲时,我需要它更改列表框中的索引并转到第二首歌曲,然后是第三首歌曲,依此类推。 I used this condition:
我使用了这个条件:
if (axWindowsMediaPlayer1.playState() = WMPLib.WMPPlayState.wmppsMediaEnded)
The part " playState() " is underlined and it shows me an error: " Non-invocable member "axWindowsMediaPlayer1.playState" cannot be used like a method. " I tried deleting brackets but it just underlined the whole part " axWindowsMediaPlayer1.playState ". “ playState() ”部分带有下划线,它向我显示了一个错误:“不可调用成员“axWindowsMediaPlayer1.playState”不能像方法一样使用。 ”我尝试删除括号,但它只是在整个部分“ axWindowsMediaPlayer1.playState ”下划线. Can someone help me?
有人能帮我吗?
Thank you very much.非常感谢。
You can use the following code to play the file one by one.您可以使用以下代码将文件一一播放。
private void button1_Click(object sender, EventArgs e)
{
SoundPlayer player = new SoundPlayer(@"2.wav");
player.PlaySync();
player = new SoundPlayer(@"\1.wav");
player.PlaySync();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.