Merge pull request #1255 from Scrxtchy/Clipboard-QR

Automatically fill QR window with Clipboard Content
This commit is contained in:
Jaex 2016-01-16 04:46:28 +02:00
commit bb3fbf637d

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;
@ -138,4 +158,4 @@ private void tsmiSaveAs_Click(object sender, EventArgs e)
}
}
}
}
}