Toasts – Diff between revs 24 and 25
?pathlinks?
Rev 24 | Rev 25 | |||
---|---|---|---|---|
Line 18... | Line 18... | |||
18 | namespace Toasts |
18 | namespace Toasts |
|
19 | { |
19 | { |
|
20 | public partial class ToastForm : Form |
20 | public partial class ToastForm : Form |
|
21 | { |
21 | { |
|
22 | #region Public Fields and Properties |
22 | #region Public Fields and Properties |
|
- | 23 | |
||
23 | public bool EnableChime { get; set; } = true; |
24 | public bool EnableChime { get; set; } = true; |
|
Line 24... | Line 25... | |||
24 | |
25 | |
|
Line 25... | Line 26... | |||
25 | public int LingerTime { get; set; } = 5000; |
26 | public int LingerTime { get; set; } = 5000; |
|
Line 94... | Line 95... | |||
94 | Chime = memoryStream.ToArray(); |
95 | Chime = memoryStream.ToArray(); |
|
95 | } |
96 | } |
|
Line 96... | Line 97... | |||
96 | |
97 | |
|
Line 97... | Line 98... | |||
97 | _showFormTaskCompletionSource = new TaskCompletionSource<object>(); |
98 | _showFormTaskCompletionSource = new TaskCompletionSource<object>(); |
|
98 | |
99 | |
|
99 | _toastTimer = new System.Timers.Timer { Enabled = true, AutoReset = false, Interval = LingerTime }; |
100 | _toastTimer = new System.Timers.Timer { Enabled = false, AutoReset = false, Interval = LingerTime }; |
|
Line 100... | Line 101... | |||
100 | _toastTimer.Elapsed += ToastTimer_Elapsed; |
101 | _toastTimer.Elapsed += ToastTimer_Elapsed; |
|
101 | } |
102 | } |
|
Line 148... | Line 149... | |||
148 | |
149 | |
|
Line 149... | Line 150... | |||
149 | #endregion |
150 | #endregion |
|
Line 150... | Line 151... | |||
150 | |
151 | |
|
151 | #region Event Handlers |
152 | #region Event Handlers |
|
152 | |
153 | |
|
153 | private void Notification_Load(object sender, EventArgs e) |
154 | private void ToastForm_Load(object sender, EventArgs e) |
|
154 | { |
155 | { |
|
155 | if (EnableChime) |
156 | if (EnableChime) |
|
Line 216... | Line 217... | |||
216 | Location = new Point(_screenWidth - Width, _screenHeight - Height); |
217 | Location = new Point(_screenWidth - Width, _screenHeight - Height); |
|
217 | })); |
218 | })); |
|
Line 218... | Line 219... | |||
218 | |
219 | |
|
Line -... | Line 220... | |||
- | 220 | OpenNotifications.Add(this); |
||
219 | OpenNotifications.Add(this); |
221 | |
|
220 | |
222 | _toastTimer.Enabled = true; |
|
221 | _toastTimer.Start(); |
223 | _toastTimer.Start(); |
|
222 | } |
224 | } |
|
223 | } |
225 | } |
|
224 | catch |
226 | catch |
|
225 | { |
227 | { |
|
226 | Debug.WriteLine("Error on form load event."); |
228 | Debug.WriteLine("Error on form load event."); |
|
Line 227... | Line 229... | |||
227 | } |
229 | } |
|
228 | } |
230 | } |
|
229 | |
231 | |
|
230 | private void Notification_FormClosed(object sender, FormClosedEventArgs e) |
232 | private void ToastForm_FormClosed(object sender, FormClosedEventArgs e) |
|
231 | { |
233 | { |
|
232 | try |
234 | try |
|
Line 240... | Line 242... | |||
240 | { |
242 | { |
|
241 | Debug.WriteLine("Error in form closed event."); |
243 | Debug.WriteLine("Error in form closed event."); |
|
242 | } |
244 | } |
|
243 | } |
245 | } |
|
Line 244... | Line 246... | |||
244 | |
246 | |
|
245 | private void Notification_Shown(object sender, EventArgs e) |
247 | private void ToastForm_Shown(object sender, EventArgs e) |
|
246 | { |
248 | { |
|
247 | // Reverse animation direction for hiding. |
249 | // Reverse animation direction for hiding. |
|
248 | switch (_formAnimator.Direction) |
250 | switch (_formAnimator.Direction) |
|
249 | { |
251 | { |