Added feedback on successfully export
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user