操作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("无法找到视频文件!");
}

posted @ 2018-11-07 14:44  liu_xh  阅读(320)  评论(0编辑  收藏  举报