Example #1
0
        public override void UpdateState()
        {
            this.Progress     = -1f;
            this.CollectionId = -1;
            this.HasPoints    = false;
            this.Downloading  = false;
            bool fIsDownloadPending = false;
            bool fIsHidden          = false;

            if (this.AllowDownload)
            {
                if (ZuneApplication.Service.IsDownloading(this.Id, this.ContentType, out fIsDownloadPending, out fIsHidden))
                {
                    this.Downloading = true;
                    if (fIsDownloadPending)
                    {
                        this.Description = Shell.LoadString(StringId.IDS_PENDING);
                    }
                    else
                    {
                        this.Description = string.Empty;
                        DownloadTask task = DownloadManager.Instance.GetTask(this.Id.ToString());
                        if (task == null)
                        {
                            return;
                        }
                        this.UpdateProgress(this.Id, task.GetProgress());
                    }
                }
                else
                {
                    this.Description = Shell.LoadString(StringId.IDS_DOWNLOAD);
                    this.Downloading = false;
                }
            }
            else
            {
                this.Description = Shell.LoadString(StringId.IDS_NOT_AVAILABLE);
                this.Available   = false;
            }
        }