2024-06-10 15:57:04 +02:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows;
|
2024-07-01 16:21:03 +02:00
|
|
|
|
using bib_talk.Repository;
|
2024-06-10 15:57:04 +02:00
|
|
|
|
|
|
|
|
|
namespace bib_talk
|
|
|
|
|
{
|
|
|
|
|
public partial class Login : Window
|
|
|
|
|
{
|
2024-07-01 16:21:03 +02:00
|
|
|
|
LoginDatabase loginDatabase;
|
|
|
|
|
|
|
|
|
|
|
2024-06-10 15:57:04 +02:00
|
|
|
|
// Field to store logged in user
|
|
|
|
|
public static string loggedInUser;
|
|
|
|
|
|
|
|
|
|
public Login()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2024-07-01 16:21:03 +02:00
|
|
|
|
|
|
|
|
|
loginDatabase = new LoginDatabase(this);
|
2024-06-10 15:57:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.ButtonState == MouseButtonState.Pressed)
|
|
|
|
|
{
|
|
|
|
|
DragMove();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RegisterWindow register = new RegisterWindow();
|
|
|
|
|
register.Show();
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
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-01 16:21:03 +02:00
|
|
|
|
|
|
|
|
|
await loginDatabase.LoginServer();
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Register_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RegisterWindow register = new RegisterWindow();
|
|
|
|
|
register.Show();
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|