public FileManager() { InitializeComponent(); presenter = new Presenter(this); listView1.MouseDoubleClick += ListView1_MouseDoubleClick; listView2.MouseDoubleClick += ListView2_MouseDoubleClick; listView1.Enter += ListView1_Enter; listView2.Enter += ListView2_Enter; drives = Environment.GetLogicalDrives(); for (int i = 0; i < drives.Length; i++) { comboBox1.Items.Add(drives[i]); comboBox2.Items.Add(drives[i]); } comboBox1.Text = drives[0]; comboBox2.Text = drives[0]; presenter.Refresh(listView1, @drives[0]); presenter.Refresh(listView2, @drives[0]); comboBox1.SelectedIndexChanged += ComboBox1_SelectedIndexChanged; comboBox2.SelectedIndexChanged += ComboBox2_SelectedIndexChanged; }
void ComboBox2_SelectedIndexChanged(object sender, EventArgs e) { string path = drives[comboBox2.SelectedIndex]; try { presenter.Refresh(listView2, path); presenter.CurrentPath2 = path; } catch (IOException ex) { MessageBox.Show("Not found", "Error"); comboBox1.Text = drives[0]; path = @"C:\"; presenter.Refresh(listView2, path); presenter.CurrentPath2 = path; } }