public Dictionary <int, string> GetAudioLanguages() { Dictionary <int, string> ret = new Dictionary <int, string>(); IWMPControls3 wmpcontrols3 = this.Player.Ctlcontrols as IWMPControls3; if (wmpcontrols3 != null) { for (int i = 1; i <= wmpcontrols3.audioLanguageCount; ++i) { try { int ind = wmpcontrols3.getAudioLanguageID(i); if (!ret.ContainsKey(ind) && ind > 0) // on Windows 7 64 was returned negative value -5 { ret.Add(ind, wmpcontrols3.getLanguageName(ind)); } // else Console.WriteLine("Duplicated key {0} for language {1}", ind, wmpcontrols3.getLanguageName(ind)); } catch { return(ret); } } } return(ret); }
private void PlayVoiceFile(string voicePath) { wplayer = new WindowsMediaPlayer(); wplayer.URL = voicePath; IWMPControls3 controls = (IWMPControls3)wplayer.controls; controls.play(); wplayer.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(Wplayer_StatusChange); wplayer.MediaError += new _WMPOCXEvents_MediaErrorEventHandler(Player_MediaError); }