Automatically fill QR window with Clipboard Content

This commit is contained in:
Scratch 2016-01-16 13:12:21 +11:00
parent 460c2a0792
commit f2b4b8331f

View file

@ -53,11 +53,31 @@ public QRCodeForm(string text = null)
{
EditMode = true;
txtQRCode.Visible = true;
txtQRCode.Text = "Text";
if (Clipboard.ContainsText())
{
text = Clipboard.GetText();
if (!string.IsNullOrEmpty(text) && URLHelpers.IsValidURLRegex(text))
{
txtQRCode.Text = text;
}
else
{
default_Text();
}
}
else
{
default_Text();
}
txtQRCode.SelectAll();
}
}
private void default_Text()
{
txtQRCode.Text = "Input text to convert";
}
private void txtQRCode_TextChanged(object sender, EventArgs e)
{
qrMain.Text = txtQRCode.Text;