///<summary> ///Updates the metainfo about the current song ///</summary> public void UpdateMetaInfo() { PerformUpdateMetaInfoDelegate SendDelegate = new PerformUpdateMetaInfoDelegate(this.PerformUpdateMetaInfo); System.AsyncCallback CallBack = new System.AsyncCallback(this.UpdateMetaInfoCallBack); SendDelegate.BeginInvoke(CallBack, null); }
protected void UpdateMetaInfoCallBack(System.IAsyncResult Res) { PerformUpdateMetaInfoDelegate SendDelegate = (PerformUpdateMetaInfoDelegate)((System.Runtime.Remoting.Messaging.AsyncResult)Res).AsyncDelegate; MetaInfo ConcurrentSong = SendDelegate.EndInvoke(Res); if (this._CurrentSong == null || !this._CurrentSong.Streaming) { this._CurrentSong = ConcurrentSong; if (this._CurrentSong.Streaming) { this.SetTimer(); if (this.OnNewSong != null) { this.OnNewSong(this, ConcurrentSong); } } else { this.SetTimer(5000); } } else { if (!MetaInfo.Equals(ConcurrentSong, this._CurrentSong)) { //Perform on new thread, perhaps not needed at all... //Since all we are doing is IO work, not networking... this.SaveSong(this._CurrentSong); this._CurrentSong = ConcurrentSong; if (this.OnNewSong != null) { this.OnNewSong(this, ConcurrentSong); } this.SetTimer(); } } }