You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
662 B
27 lines
662 B
5 months ago
|
using log4net;
|
||
|
|
||
|
namespace Service.Execute.Api;
|
||
|
|
||
|
public class SoundApi
|
||
|
{
|
||
|
private static readonly string BASE_URL = "http://localhost:5038";
|
||
|
private static readonly ILog Log = LogManager.GetLogger("SoundApi");
|
||
|
|
||
|
private static readonly HttpClient _httpClient = new HttpClient()
|
||
|
{
|
||
|
Timeout = TimeSpan.FromSeconds(5)
|
||
|
};
|
||
|
|
||
|
public static void PlayOneSound(int soundNo)
|
||
|
{
|
||
|
string url = BASE_URL + "/Api/PlayOneSound?soundcode=" + soundNo;
|
||
|
try
|
||
|
{
|
||
|
_httpClient.GetStringAsync(url);
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
Log.Error($" SoundApi PlayOneSound e = {e}");
|
||
|
}
|
||
|
}
|
||
|
}
|