private void listBox_timkiem_DoubleClick(object sender, EventArgs e) { ListBox list = sender as ListBox; if (list.SelectedItem != null) { XTxt.WriteFirstLine(XPath.pathfile_history_file, list.SelectedItem.ToString()); string path = list.SelectedItem.ToString(); bool IsExists = false; if (System.IO.File.GetAttributes(path).HasFlag(FileAttributes.Directory)) { IsExists = System.IO.Directory.Exists(path); } else { IsExists = System.IO.File.Exists(path); } if (IsExists) { fDetail f = new fDetail(path); f.Show(); } else { MessageBox.Show("File không tồn tại"); } } }
private void treeView2_AfterSelect(object sender, TreeViewEventArgs e) { string dirnode = e.Node.Tag.ToString(); if (File.GetAttributes(dirnode) == FileAttributes.Directory) { if (treeView2.Tag != null) { GetBack(treeView2.Tag.ToString()); } XFile.LoadFileandFolded(dirnode, treeView2); txt_current.Text = treeView2.Tag.ToString(); } else { fDetail f = new fDetail(dirnode); f.ShowDialog(); XFile.LoadFileandFolded(treeView2.Tag.ToString(), treeView2); } }