Added feedback on successfully export

This commit is contained in:
2025-09-27 23:08:58 +02:00
parent 6fb3ffb680
commit 7a2100f535
2 changed files with 121 additions and 113 deletions

View File

@@ -1,5 +1,4 @@
using Adw;
using GLib;
using Logic;
using Models;
@@ -7,6 +6,9 @@ namespace Feladat1.UI.MainWindow;
public class MainWindow
{
private ToastOverlay toastOverlay;
private const string toastOverlayId = "toast_overlay";
private IUserService userService;
private const string windowId = "main_window";
@@ -88,6 +90,12 @@ public class MainWindow
{
throw new NullReferenceException(passwordLabelId);
}
toastOverlay = builder.GetObject(toastOverlayId) as ToastOverlay;
if (toastOverlay == null)
{
throw new NullReferenceException(toastOverlayId);
}
}
catch (NullReferenceException e)
{
@@ -112,13 +120,9 @@ public class MainWindow
int returnCode = userService.Create(userNameField.GetText(), emailField.GetText(), passwordField.GetText());
if (returnCode == 0)
{
ToastOverlay overlay = new ToastOverlay();
overlay.SetParent(Window);
Toast toast = new Toast();
toast.SetButtonLabel("New user exported successfully");
overlay.AddToast(toast);
toast.SetTitle("User data exported successfully");
toastOverlay.AddToast(toast);
User user = userService.Read();
emailLabel.Text_ = user.Email;