Пример #1
0
 private void btnSaveUser_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Customer newCustomer = new Customer(txtNewUserFullName.Text, txtNewUserAdress.Text, int.Parse(txtNewUserZipCode.Text), txtNewUserCity.Text, age, int.Parse(txtNewUserTelehone.Text), txtNewUserEmail.Text);
         customerList.Add(newCustomer);
         listBCustomers.Items.Refresh();
         //SaveCustomers(newCustomer);
         SaverAndLoader.ObjectToJsonString(customerList);
         ClearTextBoxes();
     }
     catch
     {
         MessageBox.Show("Alle input skal være korrekt format!");
     }
 }
Пример #2
0
        private void btnCalenderShowEvents_Click(object sender, RoutedEventArgs e)
        {
            SaverAndLoader.LoadCustomer(customerList);

            //try
            //{
            //    using (StreamReader sr = new StreamReader("TEST.txt")) //Skal bare have den rigtige sti til Event og Reservationer
            //    {
            //        string line = sr.ReadToEnd(); //Declare line variable and sets ReadToEnd to it

            //        listBoxCalender.Items.Add(line);//Add our string "line" to listbox
            //    }
            //}
            //catch (Exception)
            //{
            //    MessageBox.Show("Can't Read Path");//Catch Exception if StreamReader Fails

            //}
        }