public void NotifyObserver(Subject aSubject) { if (aSubject.GetType() == typeof(Video)) { this.NotifyObserver((Video)aSubject); } else { throw new Exception("NotifyObserver | Unknown subject"); } }
public void NotifyObserver(Subject aSubject) { this.Invoke((MethodInvoker)delegate { float pourcentage = (float)this._videoDownload.DownloadedLength * 100 / (float)this._videoDownload.Length; this.progressBarVideoDownload.Value = (int)pourcentage; this.textBoxLocalPath.Text = this._videoDownload.LocalPath; this.labelProg.Text = String.Format("Progress: {0} / {1} | {2:0.00}/sec", DownloadVideo.ConvertByteString(this._videoDownload.DownloadedLength),DownloadVideo.ConvertByteString(this._videoDownload.Length), DownloadVideo.ConvertByteString(this._videoDownload.AverageDownloadSpeed())); Debug.WriteLine(DownloadVideo.ConvertByteString(this._videoDownload.AverageDownloadSpeed())); }); }