首页 > 其他 > 详细

文件监听

时间:2019-05-28 16:30:50      阅读:94      评论:0      收藏:0      [点我收藏+]

private void button1_Click_1(object sender, System.EventArgs e)
{
if(this.folderBrowserDialog1.ShowDialog()==DialogResult.OK)
{
if(this.folderBrowserDialog1.SelectedPath.Trim()!="")
{
this.textBox1.Text=this.folderBrowserDialog1.SelectedPath.Trim();
}
}
}

private void button2_Click(object sender, System.EventArgs e)
{
if(!System.IO.Directory.Exists(this.textBox1.Text))
{
MessageBox.Show("",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
this.fileSystemWatcher1.Path=this.textBox1.Text;
MessageBox.Show(this.textBox1.Text+"",MessageBoxButtons.OK,MessageBoxIcon.Information);

}

private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e)
{//
this.richTextBox1.Text+=e.FullPath.ToString()+"\n";
}

private void fileSystemWatcher1_Created(object sender, System.IO.FileSystemEventArgs e)
{//
this.richTextBox1.Text+="\"+e.FullPath.ToString();
}

private void fileSystemWatcher1_Deleted(object sender, System.IO.FileSystemEventArgs e)
{//
this.richTextBox1.Text+="\n"+e.FullPath.ToString();
}

private void fileSystemWatcher1_Renamed(object sender, System.IO.RenamedEventArgs e)
{//
this.richTextBox1.Text+="\n"+e.FullPath.ToString();
}

文件监听

原文:https://www.cnblogs.com/ouyangkai/p/10937981.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!