コード例 #1
0
        private void PasswordBoxPasswordSignin_KeyDown(object sender, KeyEventArgs e)
        {
            string email    = TextBoxEmail.Text;
            string password = us.GetHash(PasswordSignin.Password);
            bool   u        = rep.Users.Exists(us => us.Email == email && us.Password == password);

            if (e.Key == Key.Enter)
            {
                if ((TextBoxEmail.Text == String.Empty) || (PasswordSignin.Password == String.Empty))
                {
                    MessageBox.Show("Please, fill all fields", "Oops", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    if (u == true)
                    {
                        ThisUser = rep.Users.First(us => us.Email == email && us.Password == password);
                        MyProfile profile = new MyProfile(ThisUser, rep, context);
                        profile.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Input data are incorrect!", "Oops", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
        }
コード例 #2
0
        private void Button_ClickOK(object sender, RoutedEventArgs e)
        {
            string email    = TextBoxEmail.Text;
            string password = us.GetHash(PasswordSignin.Password);

            if ((email == "") || (password == ""))
            {
                MessageBox.Show("Please, fill all fields!", "Oops", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                if (rep.Users.Exists(us => us.Email == email && us.Password == password))
                {
                    ThisUser = rep.Users.First(us => us.Email == email && us.Password == password);
                    MyProfile profile = new MyProfile(ThisUser, rep, context);
                    profile.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Input data are incorrect!", "Oops", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }