Esempio n. 1
0
 public static void SendOnHistoryPlayChanged(HistoryPlayCollection arg)
 {
     if (OnHistoryPlayChanged != null)
     {
         OnHistoryPlayChanged(null, arg);
     }
 }
Esempio n. 2
0
        public BackThread()
        {
            this._nowPlayObj     = new NowPlay();
            this._historyPlayObj = new HistoryPlayCollection();
            this._topTenObj      = new TopTenCollection();

            Global.OnNowPlayChanged += delegate
            {
                new Thread(new ThreadStart(delegate
                {
                    HistoryPlayObj = HistoryPlayCollection.CreateNewObject();
                    TopTenObj      = TopTenCollection.CreateNewObject();
                })).Start();
            };
        }
Esempio n. 3
0
        public static HistoryPlayCollection CreateNewObject()
        {
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://eradio.ua/play_history.php");
                var            data    = Encoding.ASCII.GetBytes("src=http://eradio.ua/rock/");
                request.Method      = "POST";
                request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                request.Headers.Add("Accept-Encoding", "gzip, deflate");
                request.ContentLength = data.Length;
                var stream = request.GetRequestStream();
                stream.Write(data, 0, data.Length);
                stream.Close();
                HttpWebResponse response         = (HttpWebResponse)request.GetResponse();
                Stream          streamResponse   = response.GetResponseStream();
                GZipStream      streamDecompress = new GZipStream(streamResponse, CompressionMode.Decompress);
                StreamReader    sr = new StreamReader(streamDecompress);
                string          s  = sr.ReadToEnd();
                sr.Close();

                string sPicture = "<img src=\"[^\"]*\"";
                string sArtist  = "track\"[^-]*";
                string sTrack   = "- <span>[^<]*";
                string sTime    = "time\">[^<]*";

                MatchCollection pictures = Regex.Matches(s, sPicture);
                MatchCollection artists  = Regex.Matches(s, sArtist);
                MatchCollection tracks   = Regex.Matches(s, sTrack);
                MatchCollection times    = Regex.Matches(s, sTime);

                HistoryPlayCollection historyPlayObj = new HistoryPlayCollection();
                for (int i = 0; i < artists.Count; i++)
                {
                    historyPlayObj._lstHistory.Add(new HistoryPlayItem
                    {
                        ImagePath   = pictures[i].Value.Remove(0, 10).Trim('"'),
                        ArtistName  = artists[i].Value.Remove(0, 9).Trim(' '),
                        TrackName   = tracks[i].Value.Remove(0, 8),
                        TimeVal     = times[i].Value.Remove(0, 7).Trim(' '),
                        ImageBitmap = WebProvider.GetImageBitmapFromUrl(pictures[i].Value.Remove(0, 10).Trim('"'))
                    });
                }
                return(historyPlayObj);
            }
            catch { return(null); }
        }
Esempio n. 4
0
 public HistoryPlayAdapter(Activity activity, HistoryPlayCollection historyPlay)
 {
     _activity       = activity;
     _historyPlayObj = historyPlay;
 }
Esempio n. 5
0
 private void OnHistoryPlayChanged(object obj, HistoryPlayCollection arg)
 {
     RunOnUiThread(() => {
         lViewHistory.Adapter = new HistoryPlayAdapter(this, arg);
     });
 }