You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.4 KiB
C#
65 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Media;
|
|
using System.Text;
|
|
|
|
namespace POSV.Utils
|
|
{
|
|
public class SoundUtils
|
|
{
|
|
/// <summary>
|
|
/// 播放外卖声音
|
|
/// </summary>
|
|
/// <param name="way"></param>
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|