Notifications.PlaySound not working
Created at 10 Feb 2023, 15:10
WM
Notifications.PlaySound not working
10 Feb 2023, 15:10
Hi,
I am testing the Notifications.PlaySound and cannot get the sounds to play. Am I using the method wrong or something>?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None)]
public class NewcBot : Robot
{
[Parameter(DefaultValue = "Hello world!")]
public string Message { get; set; }
readonly string SoundFilePath = "C:/Users/username/Documents/cTrader/Sounds/EntryNotification.mp3";
protected override void OnStart()
{
//
}
protected override void OnBar()
{
Notifications.PlaySound(SoundFilePath);
}
}
}
Replies
nh.zadeh
04 Mar 2023, 18:31
( Updated at: 04 Mar 2023, 18:32 )
RE:
wmclennan77 said:
Hi,
I am testing the Notifications.PlaySound and cannot get the sounds to play. Am I using the method wrong or something>?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using cAlgo.API; using cAlgo.API.Collections; using cAlgo.API.Indicators; using cAlgo.API.Internals; namespace cAlgo.Robots { [Robot(AccessRights = AccessRights.None)] public class NewcBot : Robot { [Parameter(DefaultValue = "Hello world!")] public string Message { get; set; } readonly string SoundFilePath = "C:/Users/username/Documents/cTrader/Sounds/EntryNotification.mp3"; protected override void OnStart() { // } protected override void OnBar() { Notifications.PlaySound(SoundFilePath); } } }
just add @ in following:
readonly string SoundFilePath = @"C:/Users/username/Documents/cTrader/Sounds/EntryNotification.mp3";\
or use double / (//) rathar than one /
@nh.zadeh
PanagiotisChar
10 Feb 2023, 16:11
Hi there,
Check your log in case there are any exceptions thrown.
Aieden Technologies
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar