mirror of
https://github.com/kwsch/pkNX.git
synced 2026-05-02 19:05:18 -05:00
Closes #347 Closes #341 Co-authored-by: Michael Scire <SciresM@gmail.com> Co-authored-by: sora10pls <17801814+sora10pls@users.noreply.github.com> Co-authored-by: Lusamine <30205550+Lusamine@users.noreply.github.com>
31 lines
732 B
C#
31 lines
732 B
C#
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace pkNX.WinForms;
|
|
|
|
public partial class TextInput : Form
|
|
{
|
|
public string Result { get; set; } = string.Empty;
|
|
private readonly Func<string, bool>? Validator;
|
|
|
|
public TextInput(Func<string, bool>? validator = null)
|
|
{
|
|
Validator = validator;
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Input_TextChanged(object sender, System.EventArgs e)
|
|
{
|
|
Result = Input.Text;
|
|
if (Validator != null)
|
|
B_Export.ForeColor = Validator(Result) ? Color.Green : Color.Red;
|
|
}
|
|
|
|
private void B_Export_Click(object sender, System.EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.OK;
|
|
Close();
|
|
}
|
|
}
|