void wao_OnResponseReceived(ResponseReceiveEventArgs e) { if (!timer.Enabled) { timer.Start(); } if (loadingscreen != null) { loadingscreen.Invoke(new Action(() => loadingscreen.Close())); loadingscreen.Invoke(new Action(() => loadingscreen.Dispose())); loadingscreen = null; comboBox1.SelectedItem = SettingsManager.Station; } if (comboBox1.InvokeRequired) { comboBox1.Invoke(new Action(() => wao_OnResponseReceived(e))); return; } foreach (Radio rad in e.response.radio) { if (rad.name == (String)comboBox1.SelectedItem) { if (current == null) { current = rad; wplayerSongCalls.URL = "http://translate.google.com/translate_tts?tl=en&q=" + WebUtility.UrlEncode(Translate(rad.song + " by " + rad.artist)); wplayerSongCalls.controls.play(); UpdateGUI(rad); return; } if (current.song != rad.song && current.name == rad.name) { Trigger(TriggerTypes.SONG, rad); } if (current.show != rad.show && current.name == rad.name) { Trigger(TriggerTypes.SHOW, rad); } if (current.picture != rad.picture) { Trigger(TriggerTypes.PICTURE, rad); } UpdateGUI(rad); current = rad; } } }
void wao_OnResponseReceived(ResponseReceiveEventArgs e) { if (!timer.Enabled) timer.Start(); if (loadingscreen != null) { loadingscreen.Invoke(new Action(() => loadingscreen.Close())); loadingscreen.Invoke(new Action(() => loadingscreen.Dispose())); loadingscreen = null; comboBox1.SelectedItem = SettingsManager.Station; } if (comboBox1.InvokeRequired) { comboBox1.Invoke(new Action(() => wao_OnResponseReceived(e))); return; } foreach(Radio rad in e.response.radio) { if(rad.name == (String)comboBox1.SelectedItem) { if(current == null) { current = rad; wplayerSongCalls.URL = "http://translate.google.com/translate_tts?tl=en&q=" + WebUtility.UrlEncode(Translate(rad.song + " by " + rad.artist)); wplayerSongCalls.controls.play(); UpdateGUI(rad); return; } if (current.song != rad.song && current.name == rad.name) Trigger(TriggerTypes.SONG, rad); if (current.show != rad.show && current.name == rad.name) Trigger(TriggerTypes.SHOW, rad); if (current.picture != rad.picture) Trigger(TriggerTypes.PICTURE, rad); UpdateGUI(rad); current = rad; } } }