Winify – Diff between revs 1 and 3
?pathlinks?
Rev 1 | Rev 3 | |||
---|---|---|---|---|
Line 8... | Line 8... | |||
8 | |
8 | |
|
9 | namespace Winify |
9 | namespace Winify |
|
10 | { |
10 | { |
|
11 | public partial class NotificationForm : Form |
11 | public partial class NotificationForm : Form |
|
- | 12 | { |
||
- | 13 | #region Private Delegates, Events, Enums, Properties, Indexers and Fields |
||
- | 14 | |
||
- | 15 | private Image _image; |
||
- | 16 | |
||
- | 17 | #endregion |
||
12 | { |
18 | |
|
Line 13... | Line 19... | |||
13 | #region Constructors, Destructors and Finalizers |
19 | #region Constructors, Destructors and Finalizers |
|
14 | |
20 | |
|
15 | public NotificationForm() |
21 | private NotificationForm() |
|
16 | { |
22 | { |
|
Line 17... | Line 23... | |||
17 | InitializeComponent(); |
23 | InitializeComponent(); |
|
18 | } |
24 | } |
|
- | 25 | |
||
- | 26 | public NotificationForm(Image image, string title, string text, int milliseconds) : this() |
||
19 | |
27 | { |
|
Line 20... | Line 28... | |||
20 | public NotificationForm(Image image, string title, string text, int milliseconds) : this() |
28 | _image = image; |
|
21 | { |
29 | |
|
Line 22... | Line 30... | |||
22 | pictureBox1.InvokeIfRequired(pictureBox => { pictureBox.Image = image; }); |
30 | pictureBox1.InvokeIfRequired(pictureBox => { pictureBox.Image = image; }); |
|
23 | |
31 | |
|
24 | richTextBox2.InvokeIfRequired(richTextBox => { richTextBox.Text = title; }); |
32 | richTextBox2.InvokeIfRequired(richTextBox => { richTextBox.Text = title; }); |
|
Line 25... | Line 33... | |||
25 | richTextBox1.InvokeIfRequired(richTextBox => { richTextBox.Text = text; }); |
33 | richTextBox1.InvokeIfRequired(richTextBox => { richTextBox.Text = text; }); |
|
26 | |
34 | |
|
27 | Task.Delay(milliseconds).ContinueWith(task => |
35 | Task.Delay(milliseconds).ContinueWith(task => |
|
Line 36... | Line 44... | |||
36 | { |
44 | { |
|
37 | soundPlayer.Play(); |
45 | soundPlayer.Play(); |
|
38 | } |
46 | } |
|
39 | } |
47 | } |
|
Line -... | Line 48... | |||
- | 48 | |
||
- | 49 | /// <summary> |
||
- | 50 | /// Clean up any resources being used. |
||
- | 51 | /// </summary> |
||
- | 52 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
||
- | 53 | protected override void Dispose(bool disposing) |
||
- | 54 | { |
||
- | 55 | if (disposing && components != null) |
||
- | 56 | { |
||
- | 57 | if (_image != null) |
||
- | 58 | { |
||
- | 59 | _image.Dispose(); |
||
- | 60 | _image = null; |
||
- | 61 | } |
||
- | 62 | |
||
- | 63 | components.Dispose(); |
||
- | 64 | } |
||
- | 65 | |
||
- | 66 | base.Dispose(disposing); |
||
- | 67 | } |
||
40 | |
68 | |
|
Line 41... | Line 69... | |||
41 | #endregion |
69 | #endregion |
|
Line 42... | Line 70... | |||
42 | |
70 | |
|
Line 56... | Line 84... | |||
56 | private void PictureBox2_Click(object sender, EventArgs e) |
84 | private void PictureBox2_Click(object sender, EventArgs e) |
|
57 | { |
85 | { |
|
58 | this.InvokeIfRequired(form => { form.Close(); }); |
86 | this.InvokeIfRequired(form => { form.Close(); }); |
|
59 | } |
87 | } |
|
Line -... | Line 88... | |||
- | 88 | |
||
- | 89 | private void NotificationForm_FormClosing(object sender, FormClosingEventArgs e) |
||
- | 90 | { |
||
- | 91 | if (_image != null) |
||
- | 92 | { |
||
- | 93 | _image.Dispose(); |
||
- | 94 | _image = null; |
||
- | 95 | } |
||
- | 96 | } |
||
60 | |
97 | |
|
61 | #endregion |
98 | #endregion |
|
62 | } |
99 | } |
|
63 | } |
100 | } |