1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-09-03 23:53:09 +02:00
Files
TweetDuck/Core/Notification/SoundNotification.cs

29 lines
844 B
C#

using System.Runtime.InteropServices;
using TweetDck.Core.Notification.Sound;
namespace TweetDck.Core.Notification{
static class SoundNotification{
private static bool? IsWMPAvailable;
public static ISoundNotificationPlayer New(){
if (IsWMPAvailable.HasValue){
if (IsWMPAvailable.Value){
return new SoundPlayerImplWMP();
}
else{
return new SoundPlayerImplFallback();
}
}
try{
SoundPlayerImplWMP implWMP = new SoundPlayerImplWMP();
IsWMPAvailable = true;
return implWMP;
}catch(COMException){
IsWMPAvailable = false;
return new SoundPlayerImplFallback();
}
}
}
}