private async void CreateDirecoryToServer_Click(object sender, RoutedEventArgs e) { if (await ConnectionAvailable() == true) { NameForDirectory windowName = new NameForDirectory(); if (windowName.ShowDialog() == true) { var name = windowName.NameDirectory.Text; name = windowName.NameDirectory.Text; var newDirectory = api.CreateDirectory(name); if (newDirectory != "-1") { TableDirectoriesServer.ItemsSource = null; TableDirectoriesServer.ItemsSource = api.GetDirectories(); return; } MessageBox.Show("Выбранное имя уже существует!"); } } }
private async void RenameFile_Click(object sender, RoutedEventArgs e) { if (await ConnectionAvailable() == true) { var selectItem = TableFilesFromDirectory.SelectedItem; FilesFromDirectory currentFile = (FilesFromDirectory)selectItem; if (currentFile == null) { MessageBox.Show("Выберите файл!"); return; } NameForDirectory window = new NameForDirectory(); if (window.ShowDialog() == true) { var resultRename = api.RenameFile(window.NameDirectory.Text, Convert.ToInt32(currentFile.Id)); UpdateListFiles(); } } }
private async void RenameDirectoryToServer_Click(object sender, RoutedEventArgs e) { if (await ConnectionAvailable() == true) { var selectItem = TableDirectoriesServer.SelectedItem; DirectoryFromServer currentDirectory = (DirectoryFromServer)selectItem; if (currentDirectory == null) { MessageBox.Show("Выберите директорию!"); return; } NameForDirectory window = new NameForDirectory(); if (window.ShowDialog() == true) { var resultRename = api.RenameDirectory(window.NameDirectory.Text, Convert.ToInt32(currentDirectory.Id)); TableDirectoriesServer.ItemsSource = null; TableDirectoriesServer.ItemsSource = api.GetDirectories(); } } }