public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Length == 2)
            {
                if (values[0] is PlayStateEnum)
                {
                    PlayStateEnum playState = (PlayStateEnum)values[0];

                    if (playState != PlayStateEnum.Stopped)
                    {
                        if (values[1] is Boolean)
                        {
                            Boolean showActionIcon = (Boolean)values[1];

                            Boolean visible =
                                (((playState == PlayStateEnum.Playing) && (!showActionIcon)) ||
                                 ((playState == PlayStateEnum.Paused) && (showActionIcon)));

                            if (!visible)
                            {
                                return(Visibility.Collapsed);
                            }
                        }
                    }
                }
            }

            return(Visibility.Visible);
        }
Exemplo n.º 2
0
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Length == 2)
            {
                if (values[0] is PlayStateEnum)
                {
                    PlayStateEnum playState = (PlayStateEnum)values[0];

                    if (playState == PlayStateEnum.Stopped)
                    {
                        if (values[1] is Boolean)
                        {
                            Boolean visibileWhenStopped = (Boolean)values[1];

                            if (!visibileWhenStopped)
                            {
                                return(Visibility.Collapsed);
                            }
                        }
                    }
                }
            }

            return(Visibility.Visible);
        }
Exemplo n.º 3
0
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Length == 3)
            {
                if (values[0] is PlayStateEnum)
                {
                    PlayStateEnum playState = (PlayStateEnum)values[0];

                    if (playState != PlayStateEnum.Stopped)
                    {
                        if (values[1] is MediaItem)
                        {
                            MediaItem currentlyPlayingMediaItem = values[1] as MediaItem;

                            if (values[2] is MediaItem)
                            {
                                MediaItem selectedMediaItem = values[2] as MediaItem;

                                if (selectedMediaItem == currentlyPlayingMediaItem)
                                {
                                    return(playState);
                                }
                            }
                        }
                    }
                }
            }

            return(PlayStateEnum.Stopped);
        }
Exemplo n.º 4
0
        public void ThenPlayStateOfTournamentIsSetTo(int tournamentIndex, string playStateString)
        {
            Tournament tournament = createdTournaments[tournamentIndex];

            PlayStateEnum playState = ParsePlayStateString(playStateString);

            tournament.GetPlayState().Should().Be(playState);
        }
Exemplo n.º 5
0
        public void ThenPlayStateOfRoundIsSetTo(int roundIndex, string playStateString)
        {
            RoundBase round = createdRounds[roundIndex];

            PlayStateEnum playState = ParsePlayStateString(playStateString);

            round.GetPlayState().Should().Be(playState);
        }
Exemplo n.º 6
0
        public void ThenPlayStateOfGroupIsSetTo(int groupIndex, string playStateString)
        {
            GroupBase group = createdGroups[groupIndex];

            PlayStateEnum playState = ParsePlayStateString(playStateString);

            group.GetPlayState().Should().Be(playState);
        }
Exemplo n.º 7
0
        public void PlayStateIsEqualToOngoingWhenMatchHasStartedButNotFinished()
        {
            SystemTimeMocker.SetOneSecondAfter(match.StartDateTime);
            match.Player1.IncreaseScore(GetWinningScore() - 1);

            PlayStateEnum playState = match.GetPlayState();

            playState.Should().Be(PlayStateEnum.Ongoing);
        }
Exemplo n.º 8
0
        public void PlayStateIsEqualToFinishedWhenMatchHasAWinner()
        {
            SystemTimeMocker.SetOneSecondAfter(match.StartDateTime);
            match.Player1.IncreaseScore(GetWinningScore());

            PlayStateEnum playState = match.GetPlayState();

            playState.Should().Be(PlayStateEnum.Finished);
        }
Exemplo n.º 9
0
        public void ThenMatchInGroupShouldBeInState(int matchIndex, int groupIndex, string playStateString)
        {
            PlayStateEnum playState = ParsePlayStateString(playStateString);

            GroupBase group = createdGroups[groupIndex];
            Match     match = group.Matches[matchIndex];

            match.GetPlayState().Should().Be(playState);
        }
Exemplo n.º 10
0
        private bool AllGroupsPlayStatesAre(PlayStateEnum playState)
        {
            foreach (GroupBase group in Groups)
            {
                if (group.GetPlayState() != playState)
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 11
0
        private bool AllMatchesPlayStatesAre(PlayStateEnum playState)
        {
            foreach (Match match in Matches)
            {
                if (match.GetPlayState() != playState)
                {
                    return(false);
                }
            }

            return(true);
        }
        /// <summary>
        /// Adds media items to the playlist
        /// </summary>
        /// <param name="mediaItems">Media items being added to the playlist</param>
        public void AddMediaItems(IEnumerable <MediaItem> mediaItems)
        {
            PlayStateEnum previousPlayState = PlayState;

            foreach (MediaItem mediaItem in mediaItems)
            {
                MediaItems.Add(mediaItem);
            }

            if (previousPlayState == PlayStateEnum.Stopped)
            {
                Stop();
            }
        }
        public bool Fast()
        {
            if (this.openState != OpenStateEnum.FilePlay)
                throw new ApplicationException("File is not opened!|Fast");

            if (this.playSpeed < 4 && PlayCtrl.PlayM4_Fast(playerPort))
            {
                this.playSpeed++;
                this.playState = PlayStateEnum.Play;
                return true;
            }
            else
                return false;
        }
Exemplo n.º 14
0
 //NOTE: This method will only be called externally!
 public void SetPlayState(PlayStateEnum state)
 {
     playState = state;
 }
        public bool Pause()
        {
            if (this.openState != OpenStateEnum.FilePlay)
                throw new ApplicationException("File is not opened!|Pause");

            if (PlayCtrl.PlayM4_Pause(playerPort, true))
            {
                this.playState = PlayStateEnum.Pause;
                return true;
            }
            else
                return false;
        }
 public bool OneByOne()
 {
     if (this.openState != OpenStateEnum.FilePlay)
         throw new ApplicationException("File is not opened!|OneByOne");
     if (PlayCtrl.PlayM4_OneByOne(playerPort))
     {
         this.playSpeed = 0;
         this.playState = PlayStateEnum.Single;
         return true;
     }
     else
         return false;
 }
        public bool Play()
        {
            if (this.openState != OpenStateEnum.FilePlay)
                throw new ApplicationException("File is not opened!|Play");

            if ( PlayCtrl.PlayM4_Play(playerPort, this.handle))
            {
                this.playSpeed = 0;
                this.playState = PlayStateEnum.Play;

                PlayCtrl.PlayM4_GetPictureSize(this.playerPort, out this.width, out this.height);

                return true;
            }
            else
                return false;
        }
 public bool Slow()
 {
     if (this.openState != OpenStateEnum.FilePlay)
         throw new ApplicationException("File is not opened!|Slow");
     if (this.playSpeed > -4 && PlayCtrl.PlayM4_Slow(playerPort))
     {
         this.playSpeed--;
         this.playState = PlayStateEnum.Play;
         return true;
     }
     else
         return false;
 }
Exemplo n.º 19
0
        public void PlayStateIsEqualToNotBegunBeforeMactchHasStarted()
        {
            PlayStateEnum playState = match.GetPlayState();

            playState.Should().Be(PlayStateEnum.NotBegun);
        }
        public bool Stop()
        {
            if (this.openState != OpenStateEnum.FilePlay)
                throw new ApplicationException("File is not opened!|Stop");

            if (this.playState != PlayStateEnum.Stop
                && this.playState != PlayStateEnum.Other
                && PlayCtrl.PlayM4_Stop(playerPort))
            {
                this.playState = PlayStateEnum.Stop;
                return true;
            }
            else
                return false;
        }
        public bool Close()
        {
            if (this.playerPort >= 0)
            {
                switch (this.openState)
                {
                    case OpenStateEnum.FilePlay:
                        PlayCtrl.PlayM4_CloseFile(playerPort);
                        PlayCtrl.PlayM4_FreePort(this.playerPort);
                        this.handle = IntPtr.Zero;
                        this.playSpeed = 0;
                        this.playerPort = -1;
                        this.playState = PlayStateEnum.Other;
                        this.openState = OpenStateEnum.Close;
                        break;
                    case OpenStateEnum.FileDecode:
                        PlayCtrl.PlayM4_CloseStream(this.playerPort);
                        PlayCtrl.PlayM4_FreePort(this.playerPort);
                        break;
                    case OpenStateEnum.RealDecode:
                        break;
                    case OpenStateEnum.Close:
                    case OpenStateEnum.Other:
                    default:
                        break;
                }

                this.openState = OpenStateEnum.Close;
                this.playerPort = -1;
            }

            return true;
        }