示例#1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var users        = context.Users.ToList();
            var current_user = users.Where(u => u.Username == textBox.Text);

            if (current_user.LongCount() == 1)
            {
                foreach (Users user in current_user)
                {
                    if (user.Password == passwordBox.Password)
                    {
                        string    user_login = user.Username;
                        User_menu use        = new User_menu(user_login);
                        this.Hide();
                        use.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Вы ввели не верный пароль!", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    }
                }
            }
            else
            {
                MessageBox.Show("Данного пользователя не существует!", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
示例#2
0
 private void To_main_btn_Click(object sender, RoutedEventArgs e)
 {
     if (user_current_label.Content.ToString() != "")
     {
         string    user = user_current_label.Content.ToString();
         User_menu use  = new User_menu(user.Substring(0, user.Length - 4));
         this.Hide();
         use.ShowDialog();
     }
     else
     {
         MainWindow mainw = new MainWindow();
         this.Hide();
         mainw.ShowDialog();
     }
 }
示例#3
0
        private void To_main_btn_Click(object sender, RoutedEventArgs e)
        {
            string user = username_label.Content.ToString();

            if (user != "Неизвестный")
            {
                User_menu use = new User_menu(user);
                this.Hide();
                use.ShowDialog();
            }
            else
            {
                MainWindow mainw = new MainWindow();
                this.Hide();
                mainw.ShowDialog();
            }
        }