private void addFolderTreeToolStripMenuItem_Click(object sender, EventArgs e) { if (Directory.Exists(_settings.LastDirectory)) { openFolderDialog.SelectedPath = _settings.LastDirectory; } if (openFolderDialog.ShowDialog() == DialogResult.OK) { string folderPath = openFolderDialog.SelectedPath; _settings.LastDirectory = folderPath; this.Enabled = false; WaitPanel.Left = (this.Width / 2) - (WaitPanel.Width / 2); WaitPanel.Top = (this.Height / 2) - (WaitPanel.Height / 2); WaitPanel.Visible = true; WaitPanel.BringToFront(); FileList.BeginUpdate(); WaitPanel.Refresh(); try { var files = ListFiles(folderPath, SearchOption.AllDirectories); foreach (string file in files) { Application.DoEvents(); AddFileToList(file); } } finally { WaitPanel.Visible = false; FileList.EndUpdate(); this.Enabled = true; } } }
private void addFilesToolStripMenuItem_Click(object sender, EventArgs e) { if (openVideoDialog.ShowDialog() == DialogResult.OK) { this.Enabled = false; WaitPanel.Left = (this.Width / 2) - (WaitPanel.Width / 2); WaitPanel.Top = (this.Height / 2) - (WaitPanel.Height / 2); WaitPanel.Visible = true; WaitPanel.BringToFront(); FileList.BeginUpdate(); WaitPanel.Refresh(); try { foreach (string fileName in openVideoDialog.FileNames) { Application.DoEvents(); AddFileToList(fileName); } } finally { WaitPanel.Visible = false; FileList.EndUpdate(); this.Enabled = true; } } }