我想创建一个项目。从我的文件夹获取MediaElement源,然后再次完成检查文件夹。因为我打开FTP视频文件夹并添加了新视频。
我的代码不起作用。
public MainWindow()
{
InitializeComponent();
string VideoYolu = "C:\\Users\\UAL100\\Desktop\\Videos";
string[] Videolar = Directory.GetFiles("C:\\Users\\UAL100\\Desktop\\Videos");
if (Videolar.Length > 0)
{
foreach(string video in Videolar){
FileInfo fileInfo = new FileInfo(video);
string dosyaAdi = fileInfo.Name;
VideoList.Items.Add(new ListViewItem { Content = dosyaAdi });
UAMedia.Source = new Uri(VideoYolu + dosyaAdi);
UAMedia.LoadedBehavior = MediaState.Play;
}
} else
{
MessageBox.Show("Video Not Found, Please Contact Developer.");
}
}