Replies

bogdan@devize.ro
16 Mar 2017, 12:08

I have tried on a virtual machine, new windows insatlled, winth .net Framework 4.5 ... 


@bogdan@devize.ro

bogdan@devize.ro
16 Mar 2017, 11:54

RE:

tmc. said:

Try this.

using cAlgo.API;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NotificationTest : Indicator
    {
        protected override void Initialize()
        {
            Timer.Start(3);
        }

        protected override void OnTimer()
        {
            Notifications.PlaySound("C:\\Windows\\Media\\tada.wav");
        }

        public override void Calculate(int index)
        {
        }
    }
}

 

Yes, I have tried and your code too, no play...


@bogdan@devize.ro

bogdan@devize.ro
16 Mar 2017, 11:51

Initialy, my code have a condition to play on a new bar, I do not want to play continuosly on each Calculate event, anyway, I do your test below and no sound was played

 

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class NewIndicator : Indicator
    {
        int i;
        public override void Calculate(int index)
        {
            if (IsLastBar)
            {
                i++;
                // System.Media.SoundPlayer player = new System.Media.SoundPlayer("C:\\Windows\\Media\\tada.wav");
                Notifications.PlaySound("C:\\Windows\\Media\\tada.wav");
                //player.Play();
                ChartObjects.DrawText("x", "test " + i, StaticPosition.BottomLeft, Colors.Yellow);
            }
        }
    }
}

 


@bogdan@devize.ro

bogdan@devize.ro
16 Mar 2017, 11:36

RE:

tmc. said:

Make sure you have correct path to sound file. Notifications are working fine on my end.

Belive me, it is the simply path in the word: C:\tada.wav ... I have tried 10 diffrent path woth 3 diffrent sound files ... and I have run on 2 diffrent PCs


@bogdan@devize.ro

bogdan@devize.ro
16 Mar 2017, 11:10

lucian, are u from Romania?


@bogdan@devize.ro

bogdan@devize.ro
16 Mar 2017, 11:09

Yes, this working well. But, i wonder, what is happen with Notifications.PlaySound?
​Thank you for your hint


@bogdan@devize.ro