private void ChangeDriveButton_Click(object sender, EventArgs e) { Button button = sender as Button; if (LeftPanel.Contains(button)) { //данная кнопка принадлежит левой панели LeftViewRootPath = button.Text + ":\\"; LeftPathTextBox.Text = LeftViewRootPath; LeftViewObserver.Path = LeftViewRootPath; UpdateListView(LeftListView, LeftViewRootPath); } else { //данная кнопка принадлежит правой панели RightViewRootPath = button.Text + ":\\"; RightPathTextBox.Text = RightViewRootPath; RightViewObserver.Path = RightViewRootPath; UpdateListView(RightListView, RightViewRootPath); } }