private void AddSoundIfComplete() { if (_soundToAdd != null && !string.IsNullOrWhiteSpace(_soundToAdd.AudioFile) && !string.IsNullOrWhiteSpace(_soundToAdd.ImageFile)) { Items.Clear(); SoundService.AddSound(_soundToAdd); SoundService.GetAllSounds().ForEach(a => Items.Add(a)); _soundToAdd = null; } }
private void AddSound(object sender, EventArgs e) { // ReSharper disable once LocalizableElement openFileDialog1.Filter = "Audio Files (*.wav, *.mp3)|*.wav;*.mp3"; openFileDialog1.FileName = null; openFileDialog1.Multiselect = false; var dialogResult = openFileDialog1.ShowDialog(this); if (dialogResult == DialogResult.OK && openFileDialog1.SafeFileName != null) { _soundService.AddSound(_settings, openFileDialog1.FileName, openFileDialog1.SafeFileName); RefreshSoundList(); } }
/// <summary /> public Sound() { _volume = 1; StartingPosition = TimeSpan.Zero; _pitch = 1; _soundId = new Content <AudioData>(); _minDistance = 0; _maxDistance = 1000; OnLoop = new Signal <string, int>(this); Ended = new Signal <string>(this); Loaded = new Signal <string>(this); Paused = new Signal <string>(this); Played = new Signal <string>(this); Resumed = new Signal <string>(this); Stopped = new Signal <string>(this); SoundService.AddSound(this); }