async private void renBut_Click(object sender, RoutedEventArgs e) { IEnumerable <IFileObject> selectedItem = GetSelectedItemsData(); if (selectedItem.Count() == 0) { MessageBox.Show("No elements selected", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (selectedItem.Count() > 1) { MessageBox.Show("Multiple renaming is not supported", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } CreateFileOrDir cfd = new CreateFileOrDir(selectedItem.ToList()[0]); if (cfd.ShowDialog() == true) { try { await Task.Run(() => UpdateView(FileOperator.ActiveDirectory)); } catch (Exception ex) { MessageBox.Show($"Unable to renew views: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } } }
async private void mkdirBut_Click(object sender, RoutedEventArgs e) { CreateFileOrDir crDial = new CreateFileOrDir(null, true); if (crDial.ShowDialog() == true) { await Task.Run(() => UpdateView(FileOperator.ActiveDirectory)); } }