public static void Start() { var repository = new RepositoryDb(); if (Today.Calculate().Count > 0) { Console.WriteLine("Today's birthdays:"); foreach (var n in Today.Calculate()) { Console.WriteLine($"Name: {n.Name} {n.Surname}"); } Console.WriteLine(""); } Console.WriteLine("Which birthday action do you wanna make?"); Console.WriteLine("1 - Search"); Console.WriteLine("2 - Insert"); Console.WriteLine("3 - Edit"); Console.WriteLine("4 - Delete"); Console.WriteLine("5 - Exit"); Console.Write("\nAction: "); Archive.CloseTextFile(); char operacao = Console.ReadLine().Trim().ToCharArray()[0]; switch (operacao) { case '1': Archive.ReadFile(); Search(); break; case '2': Archive.ReadFile(); Insert(); break; case '3': Archive.ReadFile(); Edit(); break; case '4': Archive.ReadFile(); Delete(); break; case '5': Archive.ReadFile(); Console.WriteLine("\nExit."); Archive.CloseTextFile(); break; default: Clean(); Header(); Console.WriteLine("\nInvalid option.\n"); Start(); break; }
public async Task Loaded(object sender, RoutedEventArgs args) { var config = RegConfig.Load(); if (config == null) { // ReSharper disable once ExpressionIsAlwaysNull var settingsVm = new SettingsVm(config); var settingsWindow = new SettingsWindow(settingsVm); if (settingsWindow.ShowDialog() == false) { _mainWindow.Close(); } else { config = settingsVm.SqlConfig; RegConfig.Save(config); } } _repositoryDb = new RepositoryDb(); _repositoryDb.Connect(config); }