-
Notifications
You must be signed in to change notification settings - Fork 0
/
frm_QuickQR.cs
64 lines (53 loc) · 1.57 KB
/
frm_QuickQR.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WinQuickQR
{
public partial class frm_QuickQR : Form
{
Timer timer = new Timer();
Form form = null;
public frm_QuickQR()
{
InitializeComponent();
}
public frm_QuickQR(Form form, Image qrImage)
{
InitializeComponent();
pb_QR.Image = qrImage;
this.form = form;
}
private void frm_QuickQR_Load(object sender, EventArgs e)
{
// Auto align to bottom right
this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
if (Properties.Settings.Default.QuickQRTimeout > 0)
{
timer.Interval = Properties.Settings.Default.QuickQRTimeout * 1000;
timer.Tick += Timer_Tick;
timer.Start();
}
}
private void Timer_Tick(object sender, EventArgs e)
{
this.Close();
}
private void frm_QuickQR_FormClosing(object sender, FormClosingEventArgs e)
{
timer.Stop();
}
private void btn_Close_Click(object sender, EventArgs e)
{
this.Close();
}
private void pb_QR_Click(object sender, EventArgs e)
{
if (form != null)
{
form.WindowState = FormWindowState.Normal;
form.Show();
this.Close();
}
}
}
}