using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Media;
using Project.Controller;

namespace Project.View;

public partial class NewEntry : Window
{
    readonly AppController? _controller;
    public NewEntry()
    {
        InitializeComponent();
    }

    public NewEntry(AppController controller)
    {
        InitializeComponent();
        _controller = controller;
    }
    private void NewEntry_Cancel_Click(object? sender, RoutedEventArgs e)
    {
        Close();
    }

    private void NewEntry_Save_Click(object? sender, RoutedEventArgs e)
    {
        string name = NameBox.Text;
        string username = UsernameMailBox.Text;
        string email = EmailBox.Text;
        string pass = PassBox.Text;
        string note = NoteBox.Text;
        AppController.NewEntrySave(name, username, email, pass, note);
        Close();
    }

    private void NewEntry_ShowPW_Click(object? sender, RoutedEventArgs e)
    {
        if (NewentryPW.PasswordChar == '*')
        {
            NewentryPW.PasswordChar = '\0';
        }
        else
        {
            NewentryPW.PasswordChar = '*';
        }
    }
    
}