QR code decode from screen is now using singleton form

This commit is contained in:
Jaex 2020-07-19 17:44:15 +03:00
parent 2a89a63baf
commit d5e9d0cab2

View file

@ -40,6 +40,21 @@ namespace ShareX
{
public partial class QRCodeForm : Form
{
private static QRCodeForm instance;
public static QRCodeForm Instance
{
get
{
if (instance == null || instance.IsDisposed)
{
instance = new QRCodeForm();
}
return instance;
}
}
private bool isReady;
public QRCodeForm(string text = null)
@ -75,7 +90,7 @@ public static QRCodeForm OpenFormDecodeFromFile(string filePath)
public static QRCodeForm OpenFormDecodeFromScreen()
{
QRCodeForm form = new QRCodeForm();
QRCodeForm form = Instance;
form.tcMain.SelectedTab = form.tpDecode;
form.DecodeFromScreen();
return form;