Example #1
0
 public void PlaySound(string sound)
 {
     long[] ids = this.SelectIDsByIndexColumn(sound);
     if ((ids != null) && (ids.Length > 0))
     {
         //PIPS.Logger.WriteLine("SoundsDataTable.PlaySound({0})", sound);
         SoundsDataEvent ev = this.SelectByID(ids[0]) as SoundsDataEvent;
         if ((ev != null) && ev.IsEnabled)
         {
             ev.Play();
         }
     }
     else if (System.IO.File.Exists(sound))
     {
         try {
             System.IO.Stream stream = System.IO.File.OpenRead(sound);
             if (stream != null)
             {
                 WavePlayback playback = new WavePlayback(stream);
                 playback.Play();
             }
         } catch (Exception ex) {
             //Logger.Exception(ex);
             try {
                 WaveBasic.PlaySoundAsync(sound);
             } catch (Exception ex2) {
                 //PIPS.Logger.Exception(ex2);
             }
         }
     }
 }
 public void Play()
 {
     //if(this.File != null) {
     try {
         //PIPS.Logger.WriteLine(false, "SoundsDataEvent.Play({0})", this.File);
         System.IO.Stream stream = System.IO.File.OpenRead(this.File);
         if (stream != null)
         {
             WavePlayback playback = new WavePlayback(stream);
             playback.Play();
         }
     } catch (Exception ex) {
         //Logger.Exception(ex);
     }
     //}
 }