private async void SearchButton_Click(object sender, RoutedEventArgs e) { resultText.Text = START; spinnerIcon.Visibility = Visibility.Visible; searchButton.IsEnabled = false; try { SetInitializer(); var process = new SearchTextProcess(_searchInitializer, new Displayer(resultText)); await process.GetSearchedFilePaths(); } catch (ArgumentNullException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { resultText.Text += $"\n{ex.Message}"; } resultText.Text += END; spinnerIcon.Visibility = Visibility.Hidden; searchButton.IsEnabled = true; }
static void Main(string[] args) { try { NameValueCollection appSettings = ConfigurationManager.AppSettings; var process = new SearchTextProcess(new SearchInitializer(appSettings), new Displayer()); process.GetSearchedFilePaths().GetAwaiter().GetResult(); Console.WriteLine("Zakończono z powodzeniem!"); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); }
static void Main(string[] args) { try { IConfigurationRoot configuration = BuildConfigration(); ISearchInitializer searchInfo = new SearchInitializer(configuration); var process = new SearchTextProcess(new SearchInitializer(configuration), new Displayer()); process.GetSearchedFilePaths().GetAwaiter().GetResult(); Console.WriteLine("Zakończono z powodzeniem!"); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); }