Esempio n. 1
0
 public MusicAssetDownloadStateChangeArgs(AvContent music, MusicAssetDownloadState state)
 {
     Music = music;
     State = state;
 }
        public void SetData(AvContent music, MusicAssetDownloadState downloadState)
        {
            TextLabel.Text       = music.DisplayName;
            DetailTextLabel.Text = music.Description;

            switch (music.ContentType)
            {
            case AvContentTypes.Audio:
                ImageView.Image = UIImage.FromBundle("i_content_audio");
                break;

            case AvContentTypes.Video:
                ImageView.Image = UIImage.FromBundle("i_content_video");
                break;

            case AvContentTypes.Unknown:
                ImageView.Image = null;
                break;
            }

            switch (downloadState)
            {
            case MusicAssetDownloadState.Downloaded:

                //DetailTextLabel.Text = null; //music.DurationString;

                accessoryProgressView.Hidden = true;

                accessoryButton.Hidden = true;

                AccessoryView = null;

                break;

            case MusicAssetDownloadState.Downloading:

                //DetailTextLabel.Text = null;

                accessoryButton.Hidden = true;

                AccessoryView = accessoryProgressView;

                accessoryProgressView.Hidden = false;

                accessoryProgressView.StartIndeterminate();

                break;

            case MusicAssetDownloadState.NotDownloaded:

                //DetailTextLabel.Text = null;

                accessoryProgressView.Hidden = true;

                var audio = music.ContentType == AvContentTypes.Audio;

                AccessoryView = audio ? accessoryButton : null;

                accessoryButton.Hidden = !audio;

                // Set the tag to use during click event
                accessoryButton.Tag = Tag;

                break;
            }

            isPlaying = false;

            if (playingTag == Tag)
            {
                SetPlaying(true);
            }
        }