/// <summary> /// Create a sound player, log an error if it fails /// </summary> /// <param name="filename">The name of the audio file to use</param> /// <returns></returns> private SoundPlayer CreateSoundPlayer(string filename) { SoundPlayer retval = null; if ((filename.Length != 0) && (filename.ToUpper() != "NONE") && (filename.ToUpper() != "NULL")) { if (System.IO.File.Exists(AppMain.BaseDirectory + "//TrialAudio//" + filename)) { try { retval = SoundFactory.createSoundPlayer(AppMain.BaseDirectory + "//TrialAudio//" + filename); } catch (Exception ex) { logger.Error("[Trial] Error creating end trial sound player: " + ex.Message); retval = null; } } else { logger.Error("[Trial] Error creating end trial sound player: the file does not exist - " + AppMain.BaseDirectory + "//TrialAudio//" + filename); } } return(retval); }