public static void addContactInterface() { Console.ForegroundColor = ConsoleColor.Magenta; Functions.createFrame(30, 7, 80, 22); Console.SetCursorPosition(45, 9); Console.Write("Dodaj Nowy Kontakt"); Console.SetCursorPosition(32, 11); Console.Write("Podaj Nazwisko:"); Console.SetCursorPosition(32, 13); Console.Write(" Podaj Imie:"); Console.SetCursorPosition(32, 15); Console.Write(" Podaj Nr Tel.:"); Console.SetCursorPosition(32, 17); Console.Write(" Podaj mail:"); Console.SetCursorPosition(47, 11); string nazwisko = Console.ReadLine(); Console.SetCursorPosition(47, 13); string imie = Console.ReadLine(); Console.SetCursorPosition(47, 15); string tel = Console.ReadLine(); int telefon = Int32.Parse(tel); Console.SetCursorPosition(47, 17); string mail = Console.ReadLine(); Console.SetCursorPosition(35, 20); Console.WriteLine("[Enter] - Potwierdź [Esc] - Odrzuć"); Console.ResetColor(); ConsoleKeyInfo key; key = Console.ReadKey(); if (key.Key == ConsoleKey.Enter) { Baza.AddContact(imie, nazwisko, telefon, mail); Functions.createContactInterface(); } if (key.Key == ConsoleKey.Escape) { Functions.createContactInterface(); } }
private void add_contact(object sender, RoutedEventArgs e) { string fname = contact_fName.Text; string lname = contact_lName.Text; string phonstring = contact_phon.Text; int phon = int.Parse(phonstring); string mail = contact_mail.Text; Baza.AddContact(fname, lname, phon, mail); contact_fName.Text = String.Empty; contact_lName.Text = String.Empty; contact_mail.Text = String.Empty; contact_phon.Text = String.Empty; label.Content = "Kontakt dodany"; List <Contact> contact = new List <Contact>(); contact = Baza.ContactList2(); dataGrid.ItemsSource = contact; }