Added feedback on successfully export
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
using Adw;
|
using Adw;
|
||||||
using GLib;
|
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Models;
|
||||||
|
|
||||||
@@ -7,6 +6,9 @@ namespace Feladat1.UI.MainWindow;
|
|||||||
|
|
||||||
public class MainWindow
|
public class MainWindow
|
||||||
{
|
{
|
||||||
|
private ToastOverlay toastOverlay;
|
||||||
|
private const string toastOverlayId = "toast_overlay";
|
||||||
|
|
||||||
private IUserService userService;
|
private IUserService userService;
|
||||||
private const string windowId = "main_window";
|
private const string windowId = "main_window";
|
||||||
|
|
||||||
@@ -88,6 +90,12 @@ public class MainWindow
|
|||||||
{
|
{
|
||||||
throw new NullReferenceException(passwordLabelId);
|
throw new NullReferenceException(passwordLabelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toastOverlay = builder.GetObject(toastOverlayId) as ToastOverlay;
|
||||||
|
if (toastOverlay == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException(toastOverlayId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (NullReferenceException e)
|
catch (NullReferenceException e)
|
||||||
{
|
{
|
||||||
@@ -112,13 +120,9 @@ public class MainWindow
|
|||||||
int returnCode = userService.Create(userNameField.GetText(), emailField.GetText(), passwordField.GetText());
|
int returnCode = userService.Create(userNameField.GetText(), emailField.GetText(), passwordField.GetText());
|
||||||
if (returnCode == 0)
|
if (returnCode == 0)
|
||||||
{
|
{
|
||||||
ToastOverlay overlay = new ToastOverlay();
|
|
||||||
overlay.SetParent(Window);
|
|
||||||
|
|
||||||
Toast toast = new Toast();
|
Toast toast = new Toast();
|
||||||
toast.SetButtonLabel("New user exported successfully");
|
toast.SetTitle("User data exported successfully");
|
||||||
|
toastOverlay.AddToast(toast);
|
||||||
overlay.AddToast(toast);
|
|
||||||
|
|
||||||
User user = userService.Read();
|
User user = userService.Read();
|
||||||
emailLabel.Text_ = user.Email;
|
emailLabel.Text_ = user.Email;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
<property name="default-width">400</property>
|
<property name="default-width">400</property>
|
||||||
<property name="default-height">400</property>
|
<property name="default-height">400</property>
|
||||||
<property name="content">
|
<property name="content">
|
||||||
|
<object class="AdwToastOverlay" id="toast_overlay">
|
||||||
|
<property name="child">
|
||||||
<object class="AdwToolbarView">
|
<object class="AdwToolbarView">
|
||||||
<child type="top">
|
<child type="top">
|
||||||
<object class="AdwHeaderBar" id="header_bar">
|
<object class="AdwHeaderBar" id="header_bar">
|
||||||
@@ -104,4 +106,6 @@
|
|||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
</interface>
|
</interface>
|
||||||
Reference in New Issue
Block a user