Toasts – Diff between revs 42 and 43

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 42 Rev 43
Line 112... Line 112...
112 const int WS_EX_TOPMOST = 0x00000008; 112 const int WS_EX_TOPMOST = 0x00000008;
113 baseParams.ExStyle |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST; 113 baseParams.ExStyle |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
Line 114... Line 114...
114 114
115 return baseParams; 115 return baseParams;
116 } 116 }
-   117 }
-   118  
-   119 public bool EnablePin { get; internal set; }
117 } 120 public Point PinPoint { get; internal set; }
118   121  
119 [DllImport("user32.dll", EntryPoint = "SetWindowPos")] 122 [DllImport("user32.dll", EntryPoint = "SetWindowPos")]
Line 120... Line 123...
120 public static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags); 123 public static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags);
Line 210... Line 213...
210 { 213 {
211 if (EnableChime) 214 if (EnableChime)
212 { 215 {
213 Task.Factory.StartNew(() => 216 Task.Factory.StartNew(() =>
214 { 217 {
-   218 try
-   219 {
215 using (var memoryStream = new MemoryStream(Chime)) 220 using (var memoryStream = new MemoryStream(Chime))
216 { 221 {
217 using (var player = new SoundPlayer(memoryStream)) 222 using (var player = new SoundPlayer(memoryStream))
218 { 223 {
219 player.Play(); 224 player.Play();
-   225 }
220 } 226 }
-   227 }
-   228 catch
-   229 {
-   230 Debug.WriteLine("Sound file could not be played.");
221 } 231 }
222 }); 232 });
223 } 233 }
Line 224... Line 234...
224   234  
Line 268... Line 278...
268 } 278 }
269 } 279 }
270 } 280 }
271 })); 281 }));
Line -... Line 282...
-   282  
-   283 if (EnablePin)
-   284 {
-   285 Invoke(new MethodInvoker(() =>
-   286 {
-   287 // set the location of the toast
-   288 Location = new Point(PinPoint.X, PinPoint.Y);
-   289 }));
-   290  
-   291 // remove top-most
-   292 SetWindowPos(Handle, -2, 0, 0, 0, 0, 0x0001 | 0x0002);
-   293  
-   294 _formAnimator.Method = AnimationMethodDetached;
-   295 _formAnimator.Direction = AnimationDirectionDetached;
-   296  
-   297 return;
-   298 }
272   299  
Line 273... Line 300...
273 var notifications = OpenNotifications.ToArray(); 300 var notifications = OpenNotifications.ToArray();
274   301  
275 foreach (var openForm in notifications) 302 foreach (var openForm in notifications)