// Copyright (C) 2015-2026 The Neo Project.
//
// CreateWalletDialog.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System.ComponentModel;

namespace Neo.GUI;

internal partial class CreateWalletDialog : Form
{
    public CreateWalletDialog()
    {
        InitializeComponent();
    }

    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    public string Password
    {
        get
        {
            return textBox2.Text;
        }
        set
        {
            textBox2.Text = value;
            textBox3.Text = value;
        }
    }

    [DefaultValue("")]
    public string WalletPath
    {
        get
        {
            return textBox1.Text;
        }
        set
        {
            textBox1.Text = value;
        }
    }

    private void textBox_TextChanged(object sender, EventArgs e)
    {
        if (textBox1.TextLength == 0 || textBox2.TextLength == 0 || textBox3.TextLength == 0)
        {
            button2.Enabled = false;
            return;
        }
        if (textBox2.Text != textBox3.Text)
        {
            button2.Enabled = false;
            return;
        }
        button2.Enabled = true;
    }

    private void button1_Click(object sender, EventArgs e)
    {
        if (saveFileDialog1.ShowDialog() == DialogResult.OK)
        {
            textBox1.Text = saveFileDialog1.FileName;
        }
    }
}
