Code fertig Kommentiert

Kommentare hinzugefügt wo sie noch gefehlt haben
This commit is contained in:
Erik 2024-08-28 13:53:39 +02:00
parent d9976ff520
commit f9d5053029
15 changed files with 142 additions and 106 deletions

View File

@ -9,40 +9,44 @@ namespace bib_talk.Business
{ {
public class LoginManager public class LoginManager
{ {
private LoginDatabase loginDatabase; private LoginDatabase loginDatabase; // LoginDatabase Objekt initialisieren
// Konstruktor für den LoginManager
public LoginManager(Login loginWindow) public LoginManager(Login loginWindow)
{ {
loginDatabase = new LoginDatabase(loginWindow); loginDatabase = new LoginDatabase(loginWindow); // LoginDatabase Objekt deklarieren
} }
// Methode zum User einloggen via LoginDatabase
public async void Login() public async void Login()
{ {
await loginDatabase.LoginServer(); await loginDatabase.LoginServer();
} }
public async Task LoginBots(string username, string password) // DEBUG METHODE
{ // Methode um Bots einzuloggen
var loginData = new { Username = username, Password = password, Email = "", Birthday = "", IsOnline = "" }; //public async Task LoginBots(string username, string password)
string json = JsonConvert.SerializeObject(loginData); //{
// var loginData = new { Username = username, Password = password, Email = "", Birthday = "", IsOnline = "" };
// string json = JsonConvert.SerializeObject(loginData);
using (var client = new HttpClient()) // using (var client = new HttpClient())
{ // {
var content = new StringContent(json, Encoding.UTF8, "application/json"); // var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/users/login", content); // var response = await client.PostAsync("http://daddypig.dns.navy:5114/api/users/login", content);
if (response.IsSuccessStatusCode) // if (response.IsSuccessStatusCode)
{ // {
var responseContent = await response.Content.ReadAsStringAsync(); // var responseContent = await response.Content.ReadAsStringAsync();
var responseData = JsonConvert.DeserializeObject<dynamic>(responseContent); // var responseData = JsonConvert.DeserializeObject<dynamic>(responseContent);
} // }
else // else
{ // {
var responseContent = await response.Content.ReadAsStringAsync(); // var responseContent = await response.Content.ReadAsStringAsync();
MessageBox.Show($"Login failed: {responseContent}"); // MessageBox.Show($"Login failed: {responseContent}");
} // }
} // }
} //}
} }
} }

View File

@ -5,40 +5,41 @@ namespace bib_talk.Business
{ {
public class MainWindowManager public class MainWindowManager
{ {
private MainWindowDatabase mwDatabase; private MainWindowDatabase mwDatabase; //MainWindowDatabase initializeren
private string loggedinUser; private string loggedInUser; // Feld um eingeloggten User zu speichern
public MainWindowManager(MainWindow mainWindow)
{
mwDatabase = new MainWindowDatabase(mainWindow);
}
// Konstruktor für MainWindowManager mit MainWindow und User Referenz
public MainWindowManager(MainWindow mainWindow, string user) public MainWindowManager(MainWindow mainWindow, string user)
{ {
mwDatabase = new MainWindowDatabase(mainWindow, user); mwDatabase = new MainWindowDatabase(mainWindow, user);
loggedinUser = user; loggedInUser = user;
} }
// Methode zum Senden einer Nachricht via Datenbankmanager
public void SendMessage() public void SendMessage()
{ {
mwDatabase.SendMessage(); mwDatabase.SendMessage();
} }
// Methode zum Laden der Nachrichten via Datenbankmanager
public void LoadMessages() public void LoadMessages()
{ {
mwDatabase.LoadMessages(); mwDatabase.LoadMessages();
} }
// Methode zum Laden der Online Benutzer via Datenbankmanager
public void LoadOnlineUsers() public void LoadOnlineUsers()
{ {
mwDatabase.LoadOnlineUsers(); mwDatabase.LoadOnlineUsers();
} }
// Methode zum Ausloggen des Users via Datenbankmanager
public void LogoutUser() public void LogoutUser()
{ {
mwDatabase.LogoutUser(); mwDatabase.LogoutUser();
} }
// Methode zum Hochladen eines Profilbildes via Datenbankmanager
public async Task UploadProfileImage(string filePath) public async Task UploadProfileImage(string filePath)
{ {
await mwDatabase.UploadProfileImage(filePath); await mwDatabase.UploadProfileImage(filePath);

View File

@ -2,6 +2,7 @@
namespace bib_talk.Business namespace bib_talk.Business
{ {
// Klasse um die Nachrichten in der Datenbank zu speichern
public class Message public class Message
{ {
public int Id { get; set; } public int Id { get; set; }

View File

@ -2,6 +2,7 @@
namespace bib_talk.Business namespace bib_talk.Business
{ {
// Klasse damit die Nachrichten in der App benutzt werden können
public class MessageDto public class MessageDto
{ {
public string Username { get; set; } public string Username { get; set; }

View File

@ -8,18 +8,23 @@ namespace bib_talk.Business
{ {
public class RegisterManager public class RegisterManager
{ {
private RegisterDatabase registerDatabase; private RegisterDatabase registerDatabase; // RegisterDatabase Objekt initialisieren
// Konstruktor für den RegisterManager
public RegisterManager(RegisterWindow registerWindow) public RegisterManager(RegisterWindow registerWindow)
{ {
registerDatabase = new RegisterDatabase(registerWindow); registerDatabase = new RegisterDatabase(registerWindow); // RegisterDatabase Objekt deklarieren
} }
// Methode um einen neuen Nutzer zu Registrieren via der RegisterDatabase
public async void RegisterServer() public async void RegisterServer()
{ {
await registerDatabase.RegisterServer(); await registerDatabase.RegisterServer();
} }
// DEBUG METHODE
// Methode um einen Bot Nutzer auf der Datenbank anzulegen
public async void RegisterBots(string username, string password, string email, string birthday) public async void RegisterBots(string username, string password, string email, string birthday)
{ {
var newUser = new { Username = username, Password = password, Email = email, Birthday = birthday, IsOnline = "" }; var newUser = new { Username = username, Password = password, Email = email, Birthday = birthday, IsOnline = "" };

View File

@ -1,5 +1,8 @@
namespace bib_talk.Business namespace bib_talk.Business
{ {
// User Klasse mit den Eigenschaften Id, Username, Password,
// Email, Birthday, IsOnline und ProfileImagePath
// um diese in der App zu Benutzen und in der Datenbank zu speichern
public class User public class User
{ {
public int Id { get; set; } public int Id { get; set; }

View File

@ -8,13 +8,15 @@ namespace bib_talk.Repository
{ {
public class LoginDatabase public class LoginDatabase
{ {
Login loginWindow; Login loginWindow; // Login Window initialisieren
// Konstruker der LoginDatabase
public LoginDatabase(Login loginWindow) public LoginDatabase(Login loginWindow)
{ {
this.loginWindow = loginWindow; this.loginWindow = loginWindow; // Login Window deklarieren
} }
// Methode um den User einzuloggen via eines Server aufrufs
public async Task LoginServer() public async Task LoginServer()
{ {
string username = loginWindow.usernbox.Text; string username = loginWindow.usernbox.Text;

View File

@ -12,28 +12,25 @@ namespace bib_talk.Repository
{ {
public class MainWindowDatabase public class MainWindowDatabase
{ {
private MainWindow mainWindow; private MainWindow mainWindow; // MainWindow initialisieren
private string loggedinUser; private string loggedinUser; // Feld um eingeloggten User zu speichern
public MainWindowDatabase(MainWindow mainWindow)
{
this.mainWindow = mainWindow;
}
// Konstruktor für MainWindowDatabase mit MainWindow und User Referenz
public MainWindowDatabase(MainWindow mainWindow, string user) public MainWindowDatabase(MainWindow mainWindow, string user)
{ {
this.mainWindow = mainWindow; this.mainWindow = mainWindow;
loggedinUser = user; loggedinUser = user;
} }
// Methode zum Senden einer Nachricht via Datenbank
public async void SendMessage() public async void SendMessage()
{ {
if (!string.IsNullOrEmpty(mainWindow.messageBOX.Text)) if (!string.IsNullOrEmpty(mainWindow.messageBox.Text))
{ {
var message = new MessageDto var message = new MessageDto
{ {
Username = mainWindow.loggedinUser, Username = mainWindow.loggedinUser,
Message = mainWindow.messageBOX.Text, Message = mainWindow.messageBox.Text,
Timestamp = DateTime.Now, Timestamp = DateTime.Now,
}; };
@ -45,13 +42,14 @@ namespace bib_talk.Repository
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
mainWindow.messageBOX.Clear(); mainWindow.messageBox.Clear();
LoadMessages(); // Reload messages after sending LoadMessages(); // Reload messages after sending
} }
} }
} }
} }
// Methode zum Laden der Nachrichten via Datenbank
public async void LoadMessages() public async void LoadMessages()
{ {
using (var client = new HttpClient()) using (var client = new HttpClient())
@ -71,6 +69,7 @@ namespace bib_talk.Repository
} }
} }
// Methode zum Laden der Online Benutzer via Datenbank
public async void LoadOnlineUsers() public async void LoadOnlineUsers()
{ {
using (var client = new HttpClient()) using (var client = new HttpClient())
@ -88,6 +87,7 @@ namespace bib_talk.Repository
} }
} }
// Methode zum Ausloggen des Users via Datenbank
public async void LogoutUser() public async void LogoutUser()
{ {
using (var client = new HttpClient()) using (var client = new HttpClient())
@ -104,6 +104,7 @@ namespace bib_talk.Repository
} }
} }
// Methode zum Hochladen eines Profilbildes via Datenbank
public async Task UploadProfileImage(string filePath) public async Task UploadProfileImage(string filePath)
{ {
using (var client = new HttpClient()) using (var client = new HttpClient())

View File

@ -8,13 +8,16 @@ namespace bib_talk.Repository
{ {
public class RegisterDatabase public class RegisterDatabase
{ {
RegisterWindow registerWindow; RegisterWindow registerWindow; // RegisterWindow initailisieren
// Konstruktor für die RegisterDatabase
public RegisterDatabase(RegisterWindow registerWindow) public RegisterDatabase(RegisterWindow registerWindow)
{ {
this.registerWindow = registerWindow; this.registerWindow = registerWindow;
} }
// Methode um einen Nutzer zu registrieren und die Daten
// in die Datenbank zu schreiben
public async Task RegisterServer() public async Task RegisterServer()
{ {
string username = registerWindow.usernbox.Text; string username = registerWindow.usernbox.Text;

View File

@ -101,7 +101,7 @@
Margin="0,30,0,0" Margin="0,30,0,0"
Background="#FF323134" Background="#FF323134"
Foreground="White" Foreground="White"
SelectionBrush="#FF6332A0" KeyDown="usernbox_KeyDown"/> SelectionBrush="#FF6332A0" KeyDown="userNameBox_KeyDown"/>
<!-- Benutzername TextBox --> <!-- Benutzername TextBox -->
<TextBlock Text="Passwort" <TextBlock Text="Passwort"
@ -124,8 +124,8 @@
FontSize="12" FontSize="12"
Width="136" Width="136"
Margin="20,20,0,0"/> Margin="20,20,0,0"/>
<Button Style="{StaticResource InvisibleButtonStyle}" Click="Register_Click"> <Button x:Name="RegisterButton" Style="{StaticResource InvisibleButtonStyle}" Click="Register_Click">
<TextBlock Text="Registrieren" <TextBlock x:Name="RegisterTextBlock" Text="Registrieren"
Foreground="#FF6332A0" Foreground="#FF6332A0"
FontSize="12" FontSize="12"
Width="66" Width="66"

View File

@ -11,9 +11,9 @@ namespace bib_talk
{ {
LoginManager loginManager; LoginManager loginManager;
// Field to store logged in user public static string loggedInUser; // Feld um eingeloggten User zu speichern
public static string loggedInUser;
// Konstruktor für das Login Fenster
public Login() public Login()
{ {
InitializeComponent(); InitializeComponent();
@ -21,6 +21,7 @@ namespace bib_talk
loginManager = new LoginManager(this); loginManager = new LoginManager(this);
} }
// Methode für Custom Draggable Area
private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{ {
if (e.ButtonState == MouseButtonState.Pressed) if (e.ButtonState == MouseButtonState.Pressed)
@ -29,18 +30,13 @@ namespace bib_talk
} }
} }
// Methode um das Fenster zu schließen
private void CloseButton_Click(object sender, RoutedEventArgs e) private void CloseButton_Click(object sender, RoutedEventArgs e)
{ {
this.Close(); this.Close();
} }
private void Button_Click(object sender, RoutedEventArgs e) // Methode um den User einzuloggen
{
RegisterWindow register = new RegisterWindow();
register.Show();
this.Close();
}
private async void WeiterButton_Click(object sender, RoutedEventArgs e) private async void WeiterButton_Click(object sender, RoutedEventArgs e)
{ {
if (usernbox.Text != "" && passwordbox.Password != "") if (usernbox.Text != "" && passwordbox.Password != "")
@ -49,6 +45,7 @@ namespace bib_talk
} }
} }
// Methode um den Weiter Button zu Aktivieren, wenn ein Nutzername und Passwort eingegeben ist
private void passwordbox_PasswordChanged(object sender, RoutedEventArgs e) private void passwordbox_PasswordChanged(object sender, RoutedEventArgs e)
{ {
if (usernbox.Text != "" && passwordbox.Password != "") if (usernbox.Text != "" && passwordbox.Password != "")
@ -65,13 +62,16 @@ namespace bib_talk
} }
} }
// Methode um das Registrierungs Fenster zu öffnen
private void Register_Click(object sender, RoutedEventArgs e) private void Register_Click(object sender, RoutedEventArgs e)
{ {
RegisterWindow register = new RegisterWindow(); RegisterWindow register = new RegisterWindow();
register.Show(); register.Show();
this.Close(); this.Close();
} }
private void usernbox_KeyDown(object sender, KeyEventArgs e)
// Methode um via der Enter Taste zum nächsten Feld zu springen
private void userNameBox_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
{ {
@ -79,6 +79,7 @@ namespace bib_talk
} }
} }
// Methode um via der Enter Taste den User einzuloggen
private void passwordbox_KeyDown(object sender, KeyEventArgs e) private void passwordbox_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
@ -90,8 +91,12 @@ namespace bib_talk
} }
} }
private void LoginBotUser(object sender, RoutedEventArgs e)
{ // 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++) // for (int i = 1; i <= 100; i++)
// { // {
// string name = "Bot"; // string name = "Bot";
@ -99,9 +104,7 @@ namespace bib_talk
// loginManager.LoginBots(name + i, password); // loginManager.LoginBots(name + i, password);
// Thread.Sleep(1000); // Thread.Sleep(1000);
// } // }
//}
}
} }
} }

View File

@ -115,7 +115,7 @@
Margin="10,61,10,10" Margin="10,61,10,10"
Background="#FF6332A0" Background="#FF6332A0"
Foreground="White" Foreground="White"
SelectionBrush="#FF6332A0" KeyDown="messageBOX_KeyDown" RenderTransformOrigin="0.5,0.5"> SelectionBrush="#FF6332A0" KeyDown="messageBox_KeyDown" RenderTransformOrigin="0.5,0.5">
<TextBox.RenderTransform> <TextBox.RenderTransform>
<TransformGroup> <TransformGroup>
<ScaleTransform ScaleX="-1" ScaleY="-1"/> <ScaleTransform ScaleX="-1" ScaleY="-1"/>
@ -147,7 +147,7 @@
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>
<TextBlock HorizontalAlignment="Left" x:Name="loggedinuser" Margin="0,-3,0,0" TextWrapping="Wrap" Text="xxxx" VerticalAlignment="Top" Height="20" Width="184" Foreground="White" RenderTransformOrigin="0.6,0.591"/> <TextBlock HorizontalAlignment="Left" x:Name="loggedInUser" Margin="0,-3,0,0" TextWrapping="Wrap" Text="xxxx" VerticalAlignment="Top" Height="20" Width="184" Foreground="White" RenderTransformOrigin="0.6,0.591"/>
<ListBox x:Name="chatlistbox" Margin="298,112,0,50" d:ItemsSource="{d:SampleData ItemCount=5}" Background="#FF323134" BorderBrush="{x:Null}" Foreground="#FF6332A0" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Grid.ColumnSpan="4" Grid.RowSpan="2"> <ListBox x:Name="chatlistbox" Margin="298,112,0,50" d:ItemsSource="{d:SampleData ItemCount=5}" Background="#FF323134" BorderBrush="{x:Null}" Foreground="#FF6332A0" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Grid.ColumnSpan="4" Grid.RowSpan="2">
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
@ -165,13 +165,13 @@
</ListBox> </ListBox>
<TextBox <TextBox
x:Name="messageBOX" x:Name="messageBox"
FontSize="20" FontSize="20"
BorderBrush="Transparent" BorderBrush="Transparent"
Margin="298,346,76,0" Margin="298,346,76,0"
Background="#FF323134" Background="#FF323134"
Foreground="White" Foreground="White"
SelectionBrush="#FF6332A0" KeyDown="messageBOX_KeyDown" Grid.ColumnSpan="4" Grid.Row="1"/> SelectionBrush="#FF6332A0" KeyDown="messageBox_KeyDown" Grid.ColumnSpan="4" Grid.Row="1"/>
<Button x:Name="weiterbutton" Click="send_Click" Content="Weiter" Foreground="White" Background="#FF6332A0" BorderThickness="0" Margin="44,346,10,0" BorderBrush="{x:Null}" Style="{StaticResource NoHoverButtonStyle}" RenderTransformOrigin="0.279,0.633" Grid.Column="3" Grid.Row="1"/> <Button x:Name="weiterbutton" Click="send_Click" Content="Weiter" Foreground="White" Background="#FF6332A0" BorderThickness="0" Margin="44,346,10,0" BorderBrush="{x:Null}" Style="{StaticResource NoHoverButtonStyle}" RenderTransformOrigin="0.279,0.633" Grid.Column="3" Grid.Row="1"/>
<Button x:Name="uplaodpb" Click="uploadpbclick" Content="Upload" Foreground="White" Background="#FF6332A0" BorderThickness="0" Margin="10,351,574,5" BorderBrush="{x:Null}" Style="{StaticResource NoHoverButtonStyle}" RenderTransformOrigin="0.279,0.633" Grid.Row="1"/> <Button x:Name="uplaodpb" Click="uploadpbclick" Content="Upload" Foreground="White" Background="#FF6332A0" BorderThickness="0" Margin="10,351,574,5" BorderBrush="{x:Null}" Style="{StaticResource NoHoverButtonStyle}" RenderTransformOrigin="0.279,0.633" Grid.Row="1"/>

View File

@ -9,21 +9,13 @@ namespace bib_talk
{ {
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
MainWindowManager mwManager; MainWindowManager mwManager; // MainWindowManager initializeren
private DispatcherTimer _timer; private DispatcherTimer _timer; // DispatcherTimer initialisieren
public string loggedinUser; public string loggedinUser; // Feld um eingeloggten User zu speichern
private bool isFirstLoad = true; private bool isFirstLoad = true;
public MainWindow() // MainWindow Konstruktor mit einem User und LoadMessages Methode
{
InitializeComponent();
InitializeTimer();
LoadData();
mwManager = new MainWindowManager(this);
}
public MainWindow(string user) public MainWindow(string user)
{ {
loggedinUser = user; loggedinUser = user;
@ -36,6 +28,7 @@ namespace bib_talk
mwManager.LoadMessages(); mwManager.LoadMessages();
} }
// Der 3 Sekunden Timer für die Nachrichten und Online Benutzer
private void InitializeTimer() private void InitializeTimer()
{ {
_timer = new DispatcherTimer _timer = new DispatcherTimer
@ -45,17 +38,21 @@ namespace bib_talk
_timer.Tick += (sender, e) => { mwManager.LoadMessages(); mwManager.LoadOnlineUsers(); }; _timer.Tick += (sender, e) => { mwManager.LoadMessages(); mwManager.LoadOnlineUsers(); };
_timer.Start(); _timer.Start();
} }
// Methode zum Usernamen in dem MainWindow anzeigen
public void LoadData() public void LoadData()
{ {
loggedinuser.Text = "Logged in as: " + loggedinUser; loggedInUser.Text = "Logged in as: " + loggedinUser;
} }
// Methode zum User ausloggen und App schließen
private void CloseButton_Click(object sender, RoutedEventArgs e) private void CloseButton_Click(object sender, RoutedEventArgs e)
{ {
mwManager.LogoutUser(); mwManager.LogoutUser();
this.Close(); this.Close();
} }
// Custom DraggableArea für das MainWindow
private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{ {
if (e.ButtonState == MouseButtonState.Pressed) if (e.ButtonState == MouseButtonState.Pressed)
@ -64,7 +61,8 @@ namespace bib_talk
} }
} }
private async void messageBOX_KeyDown(object sender, KeyEventArgs e) // Hotkey (Enter) für das Senden einer Nachricht
private async void messageBox_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
{ {
@ -72,11 +70,14 @@ namespace bib_talk
} }
} }
// Senden Button für das Senden einer Nachricht
private async void send_Click(object sender, RoutedEventArgs e) private async void send_Click(object sender, RoutedEventArgs e)
{ {
mwManager.SendMessage(); mwManager.SendMessage();
} }
// temporäre Methoden, löschen wenn karl nichts gemacht hat
#region Temporär, Karl
private void ChatFenster_Click(object sender, RoutedEventArgs e) private void ChatFenster_Click(object sender, RoutedEventArgs e)
{ {
if (popup.IsOpen = true) if (popup.IsOpen = true)
@ -116,7 +117,9 @@ namespace bib_talk
{ {
popup.IsOpen = false; popup.IsOpen = false;
} }
#endregion
// Methode zum Profilbilder hochladen
private async void uploadpbclick(object sender, RoutedEventArgs e) private async void uploadpbclick(object sender, RoutedEventArgs e)
{ {
OpenFileDialog openFileDialog = new OpenFileDialog(); OpenFileDialog openFileDialog = new OpenFileDialog();

View File

@ -95,9 +95,6 @@
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<Style TargetType="Hyperlink">
<EventSetter Event="RequestNavigate" Handler="Hyperlink_RequestNavigate"/>
</Style>
</Window.Resources> </Window.Resources>
<Border CornerRadius="15" BorderThickness="20" BorderBrush="#FF282828"> <Border CornerRadius="15" BorderThickness="20" BorderBrush="#FF282828">

View File

@ -13,26 +13,23 @@ namespace bib_talk
{ {
public partial class RegisterWindow : Window public partial class RegisterWindow : Window
{ {
RegisterManager registerManager; RegisterManager registerManager; // RegisterManager Objekt initialisieren
// Konstruktor für das RegisterWindow
public RegisterWindow() public RegisterWindow()
{ {
InitializeComponent(); InitializeComponent();
registerManager = new RegisterManager(this); registerManager = new RegisterManager(this); // RegisterManager Objekt erstellen
}
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true });
e.Handled = true;
} }
// Methode für das Schließen des Fensters
private void CloseButton_Click(object sender, RoutedEventArgs e) private void CloseButton_Click(object sender, RoutedEventArgs e)
{ {
this.Close(); this.Close();
} }
// Methode für die Custom Draggable Area
private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) private void DraggableArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{ {
if (e.ButtonState == MouseButtonState.Pressed) if (e.ButtonState == MouseButtonState.Pressed)
@ -41,6 +38,7 @@ namespace bib_talk
} }
} }
// Methode um das Login Window aufzurufen
private void Login_Click(object sender, RoutedEventArgs e) private void Login_Click(object sender, RoutedEventArgs e)
{ {
Login login = new Login(); Login login = new Login();
@ -48,6 +46,7 @@ namespace bib_talk
this.Close(); this.Close();
} }
// Methode um das Registrieren abzuschließen und das Login Window aufzurufen
private async void WeiterButton_Click(object sender, RoutedEventArgs e) private async void WeiterButton_Click(object sender, RoutedEventArgs e)
{ {
if (checkboxAGB.IsChecked == true) if (checkboxAGB.IsChecked == true)
@ -68,6 +67,8 @@ namespace bib_talk
} }
} }
// Methode um den Weiter Button zu aktivieren, wenn die "Nutzungsbedingungen"
// akzeptiert wurden
private void CheckBox_Checked(object sender, RoutedEventArgs e) private void CheckBox_Checked(object sender, RoutedEventArgs e)
{ {
SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF6332A0")); SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF6332A0"));
@ -75,6 +76,8 @@ namespace bib_talk
weiterbutton.Background = customBrush; weiterbutton.Background = customBrush;
} }
// Methode um den Weiter Button zu deaktivieren, wenn die "Nutzungsbedingungen"
// abgelehnt wurden
private void CheckBox_Unchecked(object sender, RoutedEventArgs e) private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
{ {
SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF323134")); SolidColorBrush customBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF323134"));
@ -82,6 +85,7 @@ namespace bib_talk
weiterbutton.Background = customBrush; weiterbutton.Background = customBrush;
} }
// Methode um die Eingaben des Benutzers zu validieren
private bool ValidateRegistration() private bool ValidateRegistration()
{ {
string username = usernbox.Text; string username = usernbox.Text;
@ -122,6 +126,8 @@ namespace bib_talk
return true; return true;
} }
// Methode um via den Enter Key zum nächsten Textfeld zu springen
private void emailbox_KeyDown(object sender, KeyEventArgs e) private void emailbox_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
@ -129,6 +135,8 @@ namespace bib_talk
usernbox.Focus(); usernbox.Focus();
} }
} }
// Methode um via den Enter Key zum nächsten Textfeld zu springen
private void usernbox_KeyDown(object sender, KeyEventArgs e) private void usernbox_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
@ -137,6 +145,7 @@ namespace bib_talk
} }
} }
// Methode um via den Enter Key zum nächsten Textfeld zu springen
private void passwordbox_KeyDown(object sender, KeyEventArgs e) private void passwordbox_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
@ -144,6 +153,8 @@ namespace bib_talk
bday1.Focus(); bday1.Focus();
} }
} }
// Methode um via den Enter Key zum nächsten Textfeld zu springen
private void bday1_KeyDown(object sender, KeyEventArgs e) private void bday1_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
@ -152,6 +163,7 @@ namespace bib_talk
} }
} }
// Methode um via den Enter Key zum nächsten Textfeld zu springen
private void bday2_KeyDown(object sender, KeyEventArgs e) private void bday2_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)