コード例 #1
0
 private void cmdTestErrorSound_Click(object sender, EventArgs e)
 {
     try
     {
         AudioSetting audioSetting = new AudioSetting()
         {
             Enabled          = true,
             AudioFilePath    = txtErrorAudioFilePath.Text,
             UseSystemSounds  = chkErrorUseSystemSounds.Checked,
             SoundRepeatCount = (int)errorRepeatCountNumericUpDown.Value,
             SoundVolumePerc  = errorVolumePercTrackBar.Value
         };
         if (chkErrorUseSystemSounds.Checked)
         {
             audioSetting.SystemSound = (SystemSounds)cboErrorSystemSound.SelectedIndex;
         }
         else
         {
             audioSetting.AudioFilePath = txtErrorAudioFilePath.Text;
         }
         backgroundWorker1.RunWorkerAsync(audioSetting);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #2
0
ファイル: AudioNotifier.cs プロジェクト: utobe/QuickMon
 private void PlaySoundForState(AudioSetting audioSetting)
 {
     if (audioSetting.UseSystemSounds)
     {
         PlaySystemSound(audioSetting.SystemSound, audioSetting.SoundVolumePerc, audioSetting.SoundRepeatCount);
     }
     else
     {
         PlayCustomSound(audioSetting.AudioFilePath, audioSetting.SoundVolumePerc, audioSetting.SoundRepeatCount);
     }
 }
コード例 #3
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            AudioSetting audioSetting = (AudioSetting)e.Argument;

            if (audioSetting.UseSystemSounds)
            {
                AudioNotifier.PlaySystemSound(audioSetting.SystemSound, audioSetting.SoundVolumePerc, audioSetting.SoundRepeatCount);
            }
            else
            {
                AudioNotifier.PlayCustomSound(audioSetting.AudioFilePath, audioSetting.SoundVolumePerc, audioSetting.SoundRepeatCount);
            }
        }
コード例 #4
0
 public AudioNotifierConfig()
 {
     GoodSoundSettings = new AudioSetting()
     {
         Enabled = false, UseSystemSounds = true
     };
     WarningSoundSettings = new AudioSetting()
     {
         Enabled = true, UseSystemSounds = true, SystemSound = SystemSounds.Exclamation
     };
     ErrorSoundSettings = new AudioSetting()
     {
         Enabled = true, UseSystemSounds = true, SystemSound = SystemSounds.Hand
     };
 }