示例#1
0
 public static void PlaySoundLoop(SoundPlay sp)          //A Task return type will eventually yield a void
 {
     while (PlayAlert && sp.SoundLoop > 0 && !String.IsNullOrEmpty(sp.SoundLoopFile))
     {
         sp.SoundLoop--;
         NinjaTrader.Core.Globals.PlaySound(sp.SoundLoopFile.ToString());
         Thread.Sleep(2000);
     }
 }
示例#2
0
        public static void PlaySoundFile(AlertMessage msg, GIndicatorBase indProxy)
        {
//			List<string> names = new List<string>(){"SoundFileName", "SoundPlayLoop"};
//			Dictionary<string,object> dic =	GConfig.GetConfigItems(GConfig.MainConfigFile, names);
            if (String.IsNullOrEmpty(SoundLoopFilePath))
            {
                LoadAlerConfig(indProxy);
            }
            SoundPlay soundplay = new SoundPlay(SoundLoopFilePath, SoundLoopCount);

            PlayAlert = true;
            indProxy.Print(String.Format("PlaySoundFile AlertBarsBackStr={0}, GetSoundFilePath={1}, SoundPlayLoopStr={2}",
                                         AlertBarsBack, SoundLoopFilePath, SoundLoopCount));

            Thread thdSoundPlay = new Thread(() => PlaySoundLoop(soundplay));
            Thread thdMsgShow   = new Thread(() => ShowMessage(msg));

            thdSoundPlay.Start();
            thdMsgShow.Start();
//			object name = null, loop = null;
//			if(dic.TryGetValue("SoundFileName", out name) &&
//				dic.TryGetValue("SoundPlayLoop", out loop)) {
//				string path = GConfig.GetSoundFileDir() + name.ToString();
//				indProxy.Print("GetSoundFilePath,SoundPlayLoop=" + path + ", " + loop);

//				SoundPlay soundplay = new SoundPlay(path, loop.ToString());

//				PlayAlert = true;

//				Thread thdSoundPlay = new Thread(() => PlaySoundLoop(soundplay));
//				Thread thdMsgShow = new Thread(() => ShowMessage(msg));

//				thdSoundPlay.Start();
//				thdMsgShow.Start();
//			}
        }