操作bin目录下的文件

string dir = AppDomain.CurrentDomain.BaseDirectory + "Video";
if (!System.IO.Directory.Exists(dir))
{
System.IO.Directory.CreateDirectory(dir);
}
DirectoryInfo root = new DirectoryInfo(dir);
FileInfo[] files = root.GetFiles();

if (files.Length > 0)
{
this.mediaElement.Source = new Uri(AppDomain.CurrentDomain.BaseDirectory + "Video\\" + files[0], UriKind.Relative);
}
else
{
MessageBox.Show("无法找到视频文件!");
}

猜你喜欢

转载自www.cnblogs.com/dotnetHui/p/9922438.html