private async void buttonUnite_ClickAsync(object sender, RoutedEventArgs e) { SetButtonsEnabled(false); var inputWindow = new InputWindow("Введите пропускаемую подстроку"); var result = inputWindow.ShowDialog(); if (result == true) { var substr = inputWindow.Text; try { int numOfSkippedLines; var waitWindow = new WaitWindow(); try { waitWindow.Show(); numOfSkippedLines = await Task.Run(() => TextFilesHandler.UniteFiles(substr)); } finally { waitWindow.Close(); } MessageBox.Show($"Выполнено, {numOfSkippedLines} строк пропущено"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } SetButtonsEnabled(true); }
private async void buttonGenerate_ClickAsync(object sender, RoutedEventArgs e) { SetButtonsEnabled(false); try { var waitWindow = new WaitWindow(); try { waitWindow.Show(); await Task.Run(() => TextFilesHandler.Generate100Files()); } finally { waitWindow.Close(); } MessageBox.Show("Выполнено"); } catch (Exception ex) { MessageBox.Show(ex.Message); } SetButtonsEnabled(true); }