public static void DoEvent(string eventName) { if (App.Settings.Current.Sounds.IsEnabled) { string path = App.Settings.Current.Sounds.GetPathByName(eventName); if (!string.IsNullOrEmpty(path)) { if (_player != null) { _player.Dispose(); } try { _player = new FilePlayer(path); _player.Start(); } catch (Exception ex) { _player = null; System.Diagnostics.Debug.WriteLine( string.Format("Unable to play audio file {0}: {1}", path, ex.Message)); } } } }
public static void PlayAsync(string fileName, Action<object> callback = null, object state = null) { var player = new FilePlayer(fileName); player.Done += (sender, e) => { if (callback != null) { callback(state); } player.Close(); }; player.Start(); }
public static void PlayAsync(string fileName, Action <object> callback = null, object state = null) { var player = new FilePlayer(fileName); player.Done += (sender, e) => { if (callback != null) { callback(state); } player.Close(); }; player.Start(); }