Example #1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            //getting all values from text boxes
            string firstName = fname_box.Text;
            string lastName  = lname_box.Text;
            string phoneNum  = phone_box.Text;
            string email1    = email_box.Text;
            string comp      = comp_box.Text;
            string job1      = job_box.Text;
            string adress    = adrs_box.Text;
            string path      = pathLbl.Content.ToString();

            //passing all values to new contact inside list inside contacts class
            contacts.Add_contact(new contacts()
            {
                f_name   = firstName,
                l_name   = lastName,
                fullname = (firstName + lastName),
                phone    = phoneNum,
                photo    = path,
                company  = comp,
                job      = job1,
                email    = email1,
                address  = adress
            });
            //hiding contact window and showing phonebook
            this.Hide();
            PhoneBook obj = new PhoneBook();

            obj.Show();
        }
Example #2
0
 private void Login_btn_Click(object sender, RoutedEventArgs e)
 {
     //if its login page validate the username and password
     if (signup_btn1.Content.Equals("Login"))
     {
         string UserNam  = Properties.Settings.Default.UserName;
         string Password = Properties.Settings.Default.Password;
         string u_name   = UserName.Text;
         string password = pass.Password;
         //show the phonebook page if valid details
         if (UserNam.Equals(u_name) && Password.Equals(password))
         {
             PhoneBook pb = new PhoneBook();
             pb.Show();
             this.Hide();
         }
         else
         {
             //throw error if invalid details
             MessageBox.Show("Please Enter valid username and password", "Wrong Password", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     //if its signup page set the setting of app to save the details of signup information
     else
     {
         string u_name   = UserName.Text;
         string password = pass.Password;
         //if the passwords match save the details
         if (password.Equals(rpass.Password))
         {
             Properties.Settings.Default.UserName = u_name;
             Properties.Settings.Default.Password = password;
             Properties.Settings.Default.Save();
             this.Hide();
             MainWindow mw = new MainWindow();
             mw.Show();
         }
         else
         {
             //if password do not match in two fields throw error
             MessageBox.Show("Password MisMatch ", "Password Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }