public static void addAddressInterface() { Console.ForegroundColor = ConsoleColor.Magenta; Functions.createFrame(30, 7, 80, 22); Console.SetCursorPosition(45, 9); Console.Write("Dodaj Nowy Adres"); Console.SetCursorPosition(32, 11); Console.Write(" Podaj Nazwe:"); Console.SetCursorPosition(32, 13); Console.Write(" Podaj Miasto:"); Console.SetCursorPosition(32, 15); Console.Write(" Podaj Ulice:"); Console.SetCursorPosition(32, 17); Console.Write(" Podaj telefon:"); Console.SetCursorPosition(49, 11); string compName = Console.ReadLine(); Console.SetCursorPosition(49, 13); string townName = Console.ReadLine(); Console.SetCursorPosition(49, 15); string stName = Console.ReadLine(); Console.SetCursorPosition(49, 17); string tel = Console.ReadLine(); int compPhon = Int32.Parse(tel); Console.SetCursorPosition(35, 20); Console.WriteLine("[Enter] - Potwierdź [Esc] - Odrzuć"); Console.ResetColor(); ConsoleKeyInfo key; key = Console.ReadKey(); if (key.Key == ConsoleKey.Enter) { Baza.AddAddress(compName, townName, stName, compPhon); Functions.createAddressInterface(); } if (key.Key == ConsoleKey.Escape) { Functions.createAddressInterface(); } }
private void add_address(object sender, RoutedEventArgs e) { string comp = address_comp.Text; string town = address_town.Text; string street = address_street.Text; string phonstring = address_phon.Text; int phon = int.Parse(phonstring); Baza.AddAddress(comp, town, street, phon); address_comp.Text = String.Empty; address_town.Text = String.Empty; address_street.Text = String.Empty; address_phon.Text = String.Empty; adres_lab.Content = "Adres dodany"; List <Address> adres = new List <Address>(); adres = Baza.AddressList2(); dataGrid5.ItemsSource = adres; }