2024-08-15 11:45:39 +02:00
|
|
|
|
using System.Windows.Input;
|
2024-06-10 15:57:04 +02:00
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows;
|
2024-07-03 15:58:51 +02:00
|
|
|
|
using bib_talk.Business;
|
2024-08-22 11:59:19 +02:00
|
|
|
|
using System.Windows.Controls;
|
2024-08-28 12:01:03 +02:00
|
|
|
|
using System.Threading;
|
2024-06-10 15:57:04 +02:00
|
|
|
|
|
|
|
|
|
namespace bib_talk
|
|
|
|
|
{
|
|
|
|
|
public partial class Login : Window
|
|
|
|
|
{
|
2024-07-03 15:58:51 +02:00
|
|
|
|
LoginManager loginManager;
|
2024-07-01 16:21:03 +02:00
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
public static string loggedInUser; // Feld um eingeloggten User zu speichern
|
2024-06-10 15:57:04 +02:00
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Konstruktor für das Login Fenster
|
|
|
|
|
public Login()
|
2024-06-10 15:57:04 +02:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2024-07-01 16:21:03 +02:00
|
|
|
|
|
2024-07-03 15:58:51 +02:00
|
|
|
|
loginManager = new LoginManager(this);
|
2024-06-10 15:57:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Methode für Custom Draggable Area
|
2024-06-10 15:57:04 +02:00
|
|
|
|
private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.ButtonState == MouseButtonState.Pressed)
|
|
|
|
|
{
|
|
|
|
|
DragMove();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Methode um das Fenster zu schließen
|
2024-06-10 15:57:04 +02:00
|
|
|
|
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Methode um den User einzuloggen
|
2024-07-01 16:21:03 +02:00
|
|
|
|
private async void WeiterButton_Click(object sender, RoutedEventArgs e)
|
2024-06-10 15:57:04 +02:00
|
|
|
|
{
|
|
|
|
|
if (usernbox.Text != "" && passwordbox.Password != "")
|
|
|
|
|
{
|
2024-07-03 15:58:51 +02:00
|
|
|
|
loginManager.Login();
|
2024-06-10 15:57:04 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Methode um den Weiter Button zu Aktivieren, wenn ein Nutzername und Passwort eingegeben ist
|
2024-06-10 15:57:04 +02:00
|
|
|
|
private void passwordbox_PasswordChanged(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (usernbox.Text != "" && passwordbox.Password != "")
|
|
|
|
|
{
|
|
|
|
|
SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF6332A0"));
|
|
|
|
|
weiterbutton.Foreground = Brushes.White;
|
|
|
|
|
weiterbutton.Background = customBrush;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF323134"));
|
|
|
|
|
weiterbutton.Foreground = Brushes.Gray;
|
|
|
|
|
weiterbutton.Background = customBrush;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Methode um das Registrierungs Fenster zu öffnen
|
2024-06-10 15:57:04 +02:00
|
|
|
|
private void Register_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RegisterWindow register = new RegisterWindow();
|
|
|
|
|
register.Show();
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
2024-08-28 13:53:39 +02:00
|
|
|
|
|
|
|
|
|
// Methode um via der Enter Taste zum nächsten Feld zu springen
|
|
|
|
|
private void userNameBox_KeyDown(object sender, KeyEventArgs e)
|
2024-08-22 12:19:00 +02:00
|
|
|
|
{
|
|
|
|
|
if (e.Key == Key.Enter)
|
|
|
|
|
{
|
|
|
|
|
passwordbox.Focus();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-22 11:59:19 +02:00
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Methode um via der Enter Taste den User einzuloggen
|
2024-08-22 11:59:19 +02:00
|
|
|
|
private void passwordbox_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.Key == Key.Enter)
|
|
|
|
|
{
|
|
|
|
|
if (usernbox.Text != "" && passwordbox.Password != "")
|
|
|
|
|
{
|
|
|
|
|
loginManager.Login();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-28 12:01:03 +02:00
|
|
|
|
|
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Debug Methode um 100 Bot User einzuloggen
|
|
|
|
|
// Man fügt die Methode einem Button hinzu und ruft sie als Button Click Event auf
|
|
|
|
|
|
|
|
|
|
//private void LoginBotUser(object sender, RoutedEventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// for (int i = 1; i <= 100; i++)
|
|
|
|
|
// {
|
|
|
|
|
// string name = "Bot";
|
|
|
|
|
// string password = "Bot123";
|
|
|
|
|
// loginManager.LoginBots(name + i, password);
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
2024-08-28 12:01:03 +02:00
|
|
|
|
}
|
2024-06-10 15:57:04 +02:00
|
|
|
|
}
|