private void button1_Click(object sender, EventArgs e) { string[] txt = new string[] { ".txt" }; string[] word = new string[] { ".docx", ".doc" }; string[] music = new string[] { ".mp3", ".mp4" }; string[] image = new string[] { ".jpg", ".png", ".ico" }; if (txt.Contains(txt_ext.Text)) { fOpenText f = new fOpenText(path, Loaifile.Txt); f.ShowDialog(); } else if (word.Contains(txt_ext.Text)) { fOpenText f = new fOpenText(path, Loaifile.Word); f.ShowDialog(); } else if (music.Contains(txt_ext.Text)) { fOpenMusic f = new fOpenMusic(path); f.ShowDialog(); } else if (image.Contains(txt_ext.Text)) { Form2 f = new Form2(path); f.ShowDialog(); } else { MessageBox.Show("Không hỗ trợ mở"); } }
private void listBox_timkiem_DoubleClick(object sender, EventArgs e) { ListBox list = sender as ListBox; Loaifile a = rd_word.Checked ? Loaifile.Word : Loaifile.Txt; if (list.SelectedItem != null) { XTxt.WriteFirstLine(XPath.pathfile_history_file, list.SelectedItem.ToString()); fOpenText f = new fOpenText(list.SelectedItem.ToString(), keyword, a); f.Show(); } }