示例#1
0
 public void PlaybackButton_Click(int playbackTypeSelected)
 {
     playbackType = (PlaybackType)playbackTypeSelected;
     setPlaybackRadioButton();
     AppDataAccessor.SetPlaybackType((int)playbackType);
 }
示例#2
0
        protected override async void OnActivate()
        {
            base.OnActivate();

            AppDataAccessor.SetLastViewed(Parameter.playlist.name, DateTime.Now.ToString("g"), Parameter.playlist.playlistId, Parameter.playlist.thumbnailLocation);
            Clips = Parameter.playlist.clips.ToList();

            FilteredClips = new ObservableCollection <Clip>(Clips);
            if (FilteredClips.Any())
            {
                getAngleNames();
                SelectedClip      = FilteredClips.First();
                SelectedClipIndex = 0;
                Angle nextAngle = SelectedClip.angles.FirstOrDefault(angle => angle.angleType.IsChecked);
                SelectedAngle = (nextAngle != null && nextAngle.isPreloaded) ? new Angle(nextAngle.clipAngleId, nextAngle.preloadFile) : nextAngle;
                if (listView != null)
                {
                    listView.SelectedItem = SelectedClip;
                }
            }

            getMoreClips();

            GridHeaders  = Parameter.playlist.displayColumns;
            PlaylistName = Parameter.playlist.name;

            int?playbackTypeResult = AppDataAccessor.GetPlaybackType();

            if (playbackTypeResult == null)
            {
                AppDataAccessor.SetPlaybackType((int)PlaybackType.next);
                playbackType = PlaybackType.next;
            }
            else
            {
                playbackType = (PlaybackType)playbackTypeResult;
            }
            setPlaybackRadioButton();

            dispRequest = new DisplayRequest();
            dispRequest.RequestActive();

            FiltersList = new List <FilterViewModel>();

            preloadCTS = new CancellationTokenSource();
            preloadCT  = preloadCTS.Token;
            initialClipPreload();

            bool downloadFound = false;
            BindableCollection <Playlist> downloadedPlaylists = DownloadAccessor.Instance.downloadedPlaylists;

            foreach (Playlist p in downloadedPlaylists)
            {
                if (p.playlistId == Parameter.playlist.playlistId)
                {
                    downloadFound = true;
                    break;
                }
            }
            DownloadAccessor.Instance.progressCallback = new Progress <DownloadOperation>(ProgressCallback);
            DownloadedVisibility = Visibility.Collapsed;
            if (DownloadAccessor.Instance.Downloading)
            {
                LoadActiveDownloadsAsync();
                ProgressGridVisibility   = Visibility.Visible;
                DownloadButtonVisibility = Visibility.Collapsed;
            }
            else
            {
                ProgressGridVisibility = Visibility.Collapsed;
                if (!downloadFound)
                {
                    DownloadButtonVisibility = Visibility.Visible;
                }
                else
                {
                    DownloadButtonVisibility = Visibility.Collapsed;
                    DownloadedVisibility     = Visibility.Visible;
                }
            }

            List <Angle> filteredAngles = SelectedClip.angles.Where(angle => angle.angleType.IsChecked).ToList <Angle>();

            if (filteredAngles.Count == 1)
            {
                filteredAngles.First().angleType.CheckBoxEnabled = false;
            }
            else if (filteredAngles.Count == 0)
            {
                NoAnglesText = "No angles are selected. Please select an angle to view this clip.";
            }
        }