2024-08-15 11:45:39 +02:00
|
|
|
|
using System.Threading.Tasks;
|
2024-07-03 15:58:51 +02:00
|
|
|
|
using bib_talk.Repository;
|
|
|
|
|
|
|
|
|
|
namespace bib_talk.Business
|
|
|
|
|
{
|
|
|
|
|
public class MainWindowManager
|
|
|
|
|
{
|
2024-08-28 13:53:39 +02:00
|
|
|
|
private MainWindowDatabase mwDatabase; //MainWindowDatabase initializeren
|
|
|
|
|
private string loggedInUser; // Feld um eingeloggten User zu speichern
|
2024-07-03 15:58:51 +02:00
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Konstruktor für MainWindowManager mit MainWindow und User Referenz
|
2024-07-03 15:58:51 +02:00
|
|
|
|
public MainWindowManager(MainWindow mainWindow, string user)
|
|
|
|
|
{
|
|
|
|
|
mwDatabase = new MainWindowDatabase(mainWindow, user);
|
2024-08-28 13:53:39 +02:00
|
|
|
|
loggedInUser = user;
|
2024-07-03 15:58:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Methode zum Senden einer Nachricht via Datenbankmanager
|
2024-07-03 15:58:51 +02:00
|
|
|
|
public void SendMessage()
|
|
|
|
|
{
|
|
|
|
|
mwDatabase.SendMessage();
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Methode zum Laden der Nachrichten via Datenbankmanager
|
2024-07-03 15:58:51 +02:00
|
|
|
|
public void LoadMessages()
|
|
|
|
|
{
|
|
|
|
|
mwDatabase.LoadMessages();
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Methode zum Laden der Online Benutzer via Datenbankmanager
|
2024-07-03 15:58:51 +02:00
|
|
|
|
public void LoadOnlineUsers()
|
|
|
|
|
{
|
|
|
|
|
mwDatabase.LoadOnlineUsers();
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 13:53:39 +02:00
|
|
|
|
// Methode zum Ausloggen des Users via Datenbankmanager
|
2024-07-03 15:58:51 +02:00
|
|
|
|
public void LogoutUser()
|
|
|
|
|
{
|
|
|
|
|
mwDatabase.LogoutUser();
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-30 10:35:09 +02:00
|
|
|
|
// Methode zum Löschen des Gesamten Chats
|
|
|
|
|
public void DeleteMessages()
|
|
|
|
|
{
|
|
|
|
|
mwDatabase.ClearMessages();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Methode zum Hochladen eines Profilbildes via Datenbankmanager
|
|
|
|
|
public async Task UploadProfileImage(string filePath)
|
2024-07-03 15:58:51 +02:00
|
|
|
|
{
|
|
|
|
|
await mwDatabase.UploadProfileImage(filePath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|