コード例 #1
0
 public static void SendOnNowPlayChanged(NowPlay arg)
 {
     if (OnNowPlayChanged != null)
     {
         OnNowPlayChanged(null, arg);
     }
 }
コード例 #2
0
 public void StartThread()
 {
     StopThread();
     threadNowPlay = new Thread(new ThreadStart(delegate
     {
         while (true)
         {
             NowPlayObj = NowPlay.CreateNewObject();
             Thread.Sleep(interval);
         }
     }));
     threadNowPlay.Start();
 }
コード例 #3
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();
            };
        }
コード例 #4
0
ファイル: ActMain.cs プロジェクト: shyshka/Eradio
 private void OnNowPlayChanged(object obj, NowPlay arg)
 {
     RunOnUiThread(() => {
         tViewArtist.Text             = arg.ARTIST_NAME;
         tViewTrack.Text              = arg.TRACK_SONG;
         Android.Graphics.Bitmap logo = WebProvider.GetImageBitmapFromUrl(arg.PICTURE);
         if (logo != null)
         {
             iViewTrack.SetImageBitmap(logo);
         }
         else
         {
             iViewTrack.SetImageResource(Resource.Drawable.Erock);
         }
         //Animation anim = AnimationUtils.LoadAnimation (this, Resource.Layout.AnimCombo);
         //iViewTrack.StartAnimation (anim);
     });
 }
コード例 #5
0
ファイル: NowPlay.cs プロジェクト: shyshka/Eradio
        public override bool Equals(object obj)
        {
            bool    res        = true;
            NowPlay objNowPlay = obj as NowPlay;

            if (objNowPlay.ARTIST_NAME != this.ARTIST_NAME)
            {
                res = false;
            }
            if (objNowPlay.TRACK_SONG != this.TRACK_SONG)
            {
                res = false;
            }
            if (objNowPlay.PICTURE != this.PICTURE)
            {
                res = false;
            }
            return(res);
        }
コード例 #6
0
ファイル: NowPlay.cs プロジェクト: shyshka/Eradio
 public static NowPlay CreateNewObject()
 {
     try
     {
         HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://eradio.ua/now_play.php");
         var            data    = Encoding.ASCII.GetBytes("src=http://eradio.ua/rock/");
         request.Method        = "POST";
         request.ContentType   = "application/x-www-form-urlencoded";
         request.ContentLength = data.Length;
         Stream stream = request.GetRequestStream();
         stream.Write(data, 0, data.Length);
         stream.Close();
         HttpWebResponse response   = (HttpWebResponse)request.GetResponse();
         Stream          streamJson = response.GetResponseStream();
         StreamReader    sr         = new StreamReader(streamJson);
         string          s          = sr.ReadToEnd();
         sr.Close();
         NowPlay nowPlayObj = JsonConvert.DeserializeObject <NowPlay>(s);
         nowPlayObj.PICTURE = "http://eradio.ua/i/" + nowPlayObj.PICTURE.Trim('\r', '\n');
         return(nowPlayObj);
     }
     catch { return(null); }
 }