using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Media; using System.Text; namespace POSV.Utils { public class SoundUtils { /// /// 播放外卖声音 /// /// public static void PlaySound(string way) { string soundPath = ""; switch (way) { case "meituan_new": soundPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"template\wav\meituan_new.wav"); if (File.Exists(soundPath)) { SoundPlayer simpleSound = new SoundPlayer(soundPath); simpleSound.Play(); } break; case "meituan_cancel": soundPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"template\wav\meituan_cancel.wav"); if (File.Exists(soundPath)) { SoundPlayer simpleSound = new SoundPlayer(soundPath); simpleSound.Play(); } break; case "eleme": soundPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"template\wav\eleme.wav"); if (File.Exists(soundPath)) { SoundPlayer simpleSound = new SoundPlayer(soundPath); simpleSound.Play(); } break; case "baidu": soundPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"template\wav\baidu.wav"); if (File.Exists(soundPath)) { SoundPlayer simpleSound = new SoundPlayer(soundPath); simpleSound.Play(); } break; case "weixin": soundPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"template\wav\meituan.wav"); if (File.Exists(soundPath)) { SoundPlayer simpleSound = new SoundPlayer(soundPath); simpleSound.Play(); } break; } } } }