示例#1
0
 public void RequestPicture(Radio rad)
 {
     if (wc.IsBusy)
     {
         //RequestPicture(rad);
         return;
     }
     wc.DownloadDataAsync(new Uri(rad.picture), "PICTURE");
 }
示例#2
0
 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;
         }
     }
 }
示例#3
0
 public void Trigger(TriggerTypes type, Radio rad)
 {
     if (type == TriggerTypes.SHOW)
     {
         notifyIcon1.ShowBalloonTip(3000, "Neue Show", rad.show + " von " + rad.moderator + " (" + rad.style + ")", ToolTipIcon.Info);
     }
     else if (type == TriggerTypes.SONG)
     {
         notifyIcon1.ShowBalloonTip(3000, "Neuer Track", rad.song + " || " + rad.artist, ToolTipIcon.Info);
         wplayerSongCalls.URL = "http://translate.google.com/translate_tts?tl=en&q=" + WebUtility.UrlEncode(Translate(rad.song + " by " + rad.artist));
         wplayerSongCalls.controls.play();
     }
     else if (type == TriggerTypes.PICTURE)
     {
         wao.RequestPicture(rad);
     }
 }
示例#4
0
 private void UpdateGUI(Radio rad)
 {
     if (pictureBox1.Image == null)
     {
         wao.RequestPicture(rad);
     }
     if (rad.release != "")
     {
         if (linkLabel1.InvokeRequired)
         {
             linkLabel1.Invoke(new Action(() => linkLabel1.Text = "(Song Release)"));
         }
         else
         {
             linkLabel1.Text = "(Song Release)";
         }
     }
     else
     {
         if (linkLabel1.InvokeRequired)
         {
             linkLabel1.Invoke(new Action(() => linkLabel1.Text = ""));
         }
         else
         {
             linkLabel1.Text = "";
         }
     }
     //Idk why we need an Invoke here...
     if (label1.InvokeRequired)
     {
         label1.Invoke(new Action(() => label1.Text = String.Format(labeltext, rad.song, rad.artist, rad.show, rad.moderator, rad.endtime + ":00", rad.listener)));
     }
     else
     {
         label1.Text = String.Format(labeltext, rad.song, rad.artist, rad.show, rad.moderator, rad.endtime + ":00", rad.listener);
     }
 }
示例#5
0
 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;
         }
     }
 }
示例#6
0
 private void UpdateGUI(Radio rad)
 {
     if (pictureBox1.Image == null)
         wao.RequestPicture(rad);
     if (rad.release != "")
     {
         if (linkLabel1.InvokeRequired)
             linkLabel1.Invoke(new Action(() => linkLabel1.Text = "(Song Release)"));
         else
             linkLabel1.Text = "(Song Release)";
     }
     else
     {
         if (linkLabel1.InvokeRequired) linkLabel1.Invoke(new Action(() => linkLabel1.Text = ""));
         else
             linkLabel1.Text = "";
     }
     //Idk why we need an Invoke here...
     if (label1.InvokeRequired)
         label1.Invoke(new Action(() => label1.Text = String.Format(labeltext, rad.song, rad.artist, rad.show, rad.moderator, rad.endtime + ":00",rad.listener)));
     else
         label1.Text = String.Format(labeltext, rad.song, rad.artist, rad.show, rad.moderator, rad.endtime + ":00",rad.listener);
 }
示例#7
0
 public void Trigger(TriggerTypes type,Radio rad)
 {
     if(type == TriggerTypes.SHOW)
     {
         notifyIcon1.ShowBalloonTip(3000, "Neue Show", rad.show + " von " + rad.moderator + " (" + rad.style + ")", ToolTipIcon.Info);
     }
     else if(type == TriggerTypes.SONG)
     {
         notifyIcon1.ShowBalloonTip(3000, "Neuer Track",rad.song + " || " + rad.artist, ToolTipIcon.Info);
         wplayerSongCalls.URL = "http://translate.google.com/translate_tts?tl=en&q=" + WebUtility.UrlEncode(Translate(rad.song + " by " + rad.artist));
         wplayerSongCalls.controls.play();
     }
     else if(type == TriggerTypes.PICTURE)
     {
         wao.RequestPicture(rad);
     }
 }