private void CompressButton_Click(object sender, EventArgs e) { int selected = LeftDirectoryView.SelectedIndex; if (selected <= 0) { MessageBox.Show(Exceptions.NotSelectedError); return; } string nameSelected = (string)LeftDirectoryView.Items[selected]; try { DirectoriesWorker.Zip(LeftPath + (nameSelected[0] == '/' ? "" : "/") + nameSelected, LeftPath + "/" + nameSelected + ".gzip"); } catch (Exception ex) { MessageBox.Show(ex.Message); } LeftPath = LeftPath; RightPath = RightPath; }
private void MoveButton_Click(object sender, EventArgs e) { int selected = LeftDirectoryView.SelectedIndex; if (selected <= 0) { MessageBox.Show(Exceptions.NotSelectedError); return; } string nameSelected = (string)LeftDirectoryView.Items[selected]; try { DirectoriesWorker.MoveFromPathToPath(LeftPath + (nameSelected[0] == '/' ? "" : "/") + nameSelected, RightPath + (nameSelected[0] == '/' ? "" : "/") + nameSelected); MessageBox.Show("Удачно перемещено"); } catch (Exception) { MessageBox.Show(Exceptions.NotInOneDiskError); } LeftPath = LeftPath; RightPath = RightPath; }
private void MainWindow_Load(object sender, EventArgs e) { LeftDirectoryView.DoubleClick += (s, args) => { if (LeftDirectoryView.SelectedIndex == 0) { LeftPath = DirectoriesWorker.BackDirectory(LeftPath); return; } string selectedItem = LeftDirectoryView.SelectedItem.ToString(); if (selectedItem[0] == '/') { LeftPath += selectedItem; } else { try { var currentWindow = new EditWindow(LeftPath + "/" + selectedItem); currentWindow.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }; RightDirectoryView.DoubleClick += (s, args) => { if (RightDirectoryView.SelectedIndex == 0) { RightPath = DirectoriesWorker.BackDirectory(RightPath); return; } string selectedItem = RightDirectoryView.SelectedItem.ToString(); if (selectedItem[0] == '/') { RightPath += selectedItem; } else { var currentWindow = new EditWindow(LeftPath + "/" + selectedItem); currentWindow.Show(); } }; LoadDriversToComboBoxes(); }
private void DeleteButton_Click(object sender, EventArgs e) { int selected = LeftDirectoryView.SelectedIndex; if (selected <= 0) { MessageBox.Show(Exceptions.NotSelectedError); return; } string nameSelected = (string)LeftDirectoryView.Items[selected]; DirectoriesWorker.Delete(LeftPath + (nameSelected[0] == '/' ? "" : "/") + nameSelected); MessageBox.Show("Удачно удалено"); LeftPath = LeftPath; RightPath = RightPath; }