private void LoopingMediaCallback(object sender, EventArgs e) { MediaProxy player = (MediaProxy)sender; player.Position = TimeSpan.Zero; player.Play(); }
private void LoadSounds(string path) { string executableFilePath = Assembly.GetExecutingAssembly().Location; string executableDirectoryPath = Path.GetDirectoryName(executableFilePath); string SoundsDerectoryPath = Path.Combine(executableDirectoryPath, path); string[] files = Directory.GetFiles(path, "*.wav"); foreach (string wavFile in files) { MediaProxy player = new MediaProxy(); string audioFilePath = Path.Combine(SoundsDerectoryPath, wavFile); player.Open(new Uri(audioFilePath)); sounds[string.Concat(wavFile.Split(new char[] { '\\' }).Last().Reverse().Skip(4).Reverse())] = player; } }