コード例 #1
0
        public override void OnReceive(Context context, Intent intent)
        {
            if (intent.Action == DataReceiver)
            {
                try
                {
                    var str   = intent.GetStringExtra("DataRadio");
                    var index = str.IndexOf(" - ");

                    data_radio        = new Model_Radio();
                    data_radio.artist = str.Substring(index + 3);
                    data_radio.track  = str.Substring(0, index);

                    var image = GetImage(String.Format("http://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=539b27f6a7781319b08e5be3719f2764&artist={0}&track={1}&format=json", data_radio.track, data_radio.artist));

                    if (image == string.Empty)
                    {
                        data_radio.image = "http://medianau.top/images/logo.png";
                    }
                    else
                    {
                        data_radio.image = image;
                    }

                    mDataRadio = (DataRadio)context;
                    mDataRadio.GetDataRadio(data_radio);
                }
                catch (Exception ex)
                {
                    Toast.MakeText(context, ex.Message + "Taras", ToastLength.Long);
                }
            }
        }
コード例 #2
0
 public void GetDataRadio(Model_Radio data)
 {
     info_radio = data;
 }