void mStartupCheckTimerTick(object sender, EventArgs e)
        {
            if (mJoystickAnnotate.IsConnected == ConnectedState.NONE)
            {
                if (mJoystickAnnotate.AttemptConnect())
                {
                    mJoystickAnnotate.IsConnected = ConnectedState.CONNECTED;
                    GP_Status.Source    = new BitmapImage(new Uri("./images/UIX_03.png", UriKind.RelativeOrAbsolute));
                    UserMessage.Content = "GAMEPAD CONNECTED";
                }
                else
                {
                    GP_Status.Source    = new BitmapImage(new Uri("./images/UIX_01.png", UriKind.RelativeOrAbsolute));
                    UserMessage.Content = "!! NO GAMEPAD DETECTED !!";
                    return;
                }
            }


            if (mVideoPlayer.State == STATE.MEDIACHANGE)
            {
                mVideoPlayer.ChangeMedia();
            }

            else if (mVideoPlayer.State == STATE.MEDIALOADED)
            {
                /* A CHANGE OF MEDIA IS REQUIRED */

                if (mPausableLoggingTimer.Enabled == true)
                {
                    mPausableLoggingTimer.Enabled = false;
                }

                UserMessage.Content = "Media is loaded...";
                mLogging.SetFileName(mVideoPlayer.mFilename);

                Media_Status.Source = new BitmapImage(new Uri("./images/UIX_04.png", UriKind.RelativeOrAbsolute));
                mVideoPlayer.State  = STATE.READY;

                mLocalState = LOCALSTATE.READYTOPLAY;
                mStartupCheckTimer.Stop();
                mTimer.Start();
            }
        }
Пример #2
0
        void mStartupCheckTimerTick(object sender, EventArgs e)
        {        
            if(mJoystickAnnotate.IsConnected == ConnectedState.NONE)
            {
                if (mJoystickAnnotate.AttemptConnect())
                {
                    mJoystickAnnotate.IsConnected = ConnectedState.CONNECTED;
                    GP_Status.Source = new BitmapImage(new Uri("./images/UIX_03.png", UriKind.RelativeOrAbsolute));
                    UserMessage.Content = "GAMEPAD CONNECTED";

                }
                else
                {
                    GP_Status.Source = new BitmapImage(new Uri("./images/UIX_01.png", UriKind.RelativeOrAbsolute));
                    UserMessage.Content = "!! NO GAMEPAD DETECTED !!";
                    return;
                }              
            }
          

            if (mVideoPlayer.State == STATE.MEDIACHANGE)
            {
                mVideoPlayer.ChangeMedia();
            }

            else if (mVideoPlayer.State == STATE.MEDIALOADED)
            {
                /* A CHANGE OF MEDIA IS REQUIRED */

                if (mPausableLoggingTimer.Enabled == true)
                    mPausableLoggingTimer.Enabled = false;

                UserMessage.Content = "Media is loaded...";
                mLogging.SetFileName(mVideoPlayer.mFilename);

                Media_Status.Source = new BitmapImage(new Uri("./images/UIX_04.png", UriKind.RelativeOrAbsolute));
                mVideoPlayer.State = STATE.READY;

                mLocalState = LOCALSTATE.READYTOPLAY;
                mStartupCheckTimer.Stop(); 
                mTimer.Start();
                
            }           
        }
Пример #3
0
        void TimerTick(object sender, EventArgs e)
        {
            // Has the gamepad been removed?
            if (mJoystickAnnotate.IsConnected == ConnectedState.NONE)
            {
                mVideoPlayer.Pause();
               
                if (mPausableLoggingTimer.Enabled == true)
                    mPausableLoggingTimer.Enabled = false;

                mLogging.SetLoggingState(LOGGINGSTATE.PAUSED);
                mStartupCheckTimer.Start();
                return;
            }

            if (mVideoPlayer.State == STATE.ENDED)
            {
                if (mLogging.GetLoggingState() != LOGGINGSTATE.POPULATED && mLogging.GetLoggingState() != LOGGINGSTATE.EXPORTED)
                {
                    if (mPausableLoggingTimer.Enabled == true)
                        mPausableLoggingTimer.Enabled = false; 
                
                    mLogging.SetLoggingState(LOGGINGSTATE.POPULATED);
                    mLogging.ExportLog(null, null);
                    UserMessage.Content = "Media Playback has ended -  Log has been automatically exported!!";
                }

                return;
            }
            else if (mVideoPlayer.State == STATE.NONE)
                Media_Status.Source = new BitmapImage(new Uri("./images/UIX_02.png", UriKind.RelativeOrAbsolute));


            if (mVideoPlayer.State == STATE.PLAYING && mJoystickAnnotate.IsConnected == ConnectedState.CONNECTED)
            {
                
                if(mLocalState == LOCALSTATE.PAUSED)
                {
                    System.TimeSpan diff1 = DateTime.Now.Subtract(mPauseTime);
                    mAccumulatedVoidTime += diff1;
                    mLocalState = LOCALSTATE.PLAYING;
                    UserMessage.Content = "Playing Media...";
                }

                if (mLocalState == LOCALSTATE.READYTOPLAY)
                {
                    mLocalState = LOCALSTATE.PLAYING;
                    UserMessage.Content = "Playing Media...";
                    ResetPrimaryItems();
                    startTime = DateTime.Now;
                    mPausableLoggingTimer.Start();     
                }

                if (mPausableLoggingTimer.Enabled == false)
                    mPausableLoggingTimer.Enabled = true;

                mLogging.SetLoggingState(LOGGINGSTATE.LOGGING);

                //if (mJoystickAnnotate.GetButtonState() == ButtonState.BUTTON2PRESSED)
                //{
                //    mVideoPlayer.Pause();
                //    return;
                //}

                mLevelChange.State = CHANGESTATE.READY;
                mLevelChange.UpdateLevels(mLogging.mLogList);
            }
             
            else if (mVideoPlayer.State == STATE.PAUSED)
            {
                if (mLocalState == LOCALSTATE.PAUSED)
                    return;

                mPauseTime = DateTime.Now;
                mLocalState = LOCALSTATE.PAUSED;
                
                if (mLogging.GetLoggingState() == LOGGINGSTATE.LOGGING)
                {
                    if (mPausableLoggingTimer.Enabled == true)
                        mPausableLoggingTimer.Enabled = false;

                    mLogging.SetLoggingState(LOGGINGSTATE.PAUSED);
                    UserMessage.Content = "Media is Paused...";
                }

                //if (mJoystickAnnotate.GetButtonState() == ButtonState.BUTTON2PRESSED)
                //{
                //    mVideoPlayer.Play();
                //    return;
                //} 
                
                if (mLevelChange.State != CHANGESTATE.UPDATED)
                    mLevelChange.UpdateLevels(mLogging.mLogList);
                
                if (LevelChangeHolder.Visibility == Visibility.Hidden)
                    LevelChangeHolder.Visibility = Visibility.Visible;
                return;
            }

            else if (mVideoPlayer.State == STATE.MEDIACHANGE)
            {
                UserMessage.Content = "Waiting for Media to load...";

                if (mVideoPlayer.ChangeMedia() == true)
                {
                    Media_Status.Source = new BitmapImage(new Uri("./images/UIX_02.png", UriKind.RelativeOrAbsolute));
                    mTimer.Stop();

                    if (mPausableLoggingTimer.Enabled == true)
                        mPausableLoggingTimer.Enabled = false;

                    mLogging.SetLoggingState(LOGGINGSTATE.NONE);
                    mLogging.Clear();
                    mLevelChange.Clear();

                    mStartupCheckTimer.Start();   
                }
            }
            else if (mVideoPlayer.State == STATE.RESTARTED)
            {
                /* A CHANGE OF MEDIA IS REQUIRED */

                if (mPausableLoggingTimer.Enabled == true)
                    mPausableLoggingTimer.Stop();

                mLogging.SetLoggingState(LOGGINGSTATE.NONE);
                mLogging.Clear();
                mLevelChange.Clear();

                UserMessage.Content = "Media has been Restarted...";
                mVideoPlayer.State = STATE.READY;
                mLocalState = LOCALSTATE.READYTOPLAY;
            }

            else
                mLogging.SetLoggingState(LOGGINGSTATE.NONE);
        }
        void TimerTick(object sender, EventArgs e)
        {
            // Has the gamepad been removed?
            if (mJoystickAnnotate.IsConnected == ConnectedState.NONE)
            {
                mVideoPlayer.Pause();

                if (mPausableLoggingTimer.Enabled == true)
                {
                    mPausableLoggingTimer.Enabled = false;
                }

                mLogging.SetLoggingState(LOGGINGSTATE.PAUSED);
                mStartupCheckTimer.Start();
                return;
            }

            if (mVideoPlayer.State == STATE.ENDED)
            {
                if (mLogging.GetLoggingState() != LOGGINGSTATE.POPULATED && mLogging.GetLoggingState() != LOGGINGSTATE.EXPORTED)
                {
                    if (mPausableLoggingTimer.Enabled == true)
                    {
                        mPausableLoggingTimer.Enabled = false;
                    }

                    mLogging.SetLoggingState(LOGGINGSTATE.POPULATED);
                    mLogging.ExportLog(null, null);
                    UserMessage.Content = "Media Playback has ended -  Log has been automatically exported!!";
                }

                return;
            }
            else if (mVideoPlayer.State == STATE.NONE)
            {
                Media_Status.Source = new BitmapImage(new Uri("./images/UIX_02.png", UriKind.RelativeOrAbsolute));
            }


            if (mVideoPlayer.State == STATE.PLAYING && mJoystickAnnotate.IsConnected == ConnectedState.CONNECTED)
            {
                if (mLocalState == LOCALSTATE.PAUSED)
                {
                    System.TimeSpan diff1 = DateTime.Now.Subtract(mPauseTime);
                    mAccumulatedVoidTime += diff1;
                    mLocalState           = LOCALSTATE.PLAYING;
                    UserMessage.Content   = "Playing Media...";
                }

                if (mLocalState == LOCALSTATE.READYTOPLAY)
                {
                    mLocalState         = LOCALSTATE.PLAYING;
                    UserMessage.Content = "Playing Media...";
                    ResetPrimaryItems();
                    startTime = DateTime.Now;
                    mPausableLoggingTimer.Start();
                }

                if (mPausableLoggingTimer.Enabled == false)
                {
                    mPausableLoggingTimer.Enabled = true;
                }

                mLogging.SetLoggingState(LOGGINGSTATE.LOGGING);

                //if (mJoystickAnnotate.GetButtonState() == ButtonState.BUTTON2PRESSED)
                //{
                //    mVideoPlayer.Pause();
                //    return;
                //}

                mLevelChange.State = CHANGESTATE.READY;
                mLevelChange.UpdateLevels(mLogging.mLogList);
            }

            else if (mVideoPlayer.State == STATE.PAUSED)
            {
                if (mLocalState == LOCALSTATE.PAUSED)
                {
                    return;
                }

                mPauseTime  = DateTime.Now;
                mLocalState = LOCALSTATE.PAUSED;

                if (mLogging.GetLoggingState() == LOGGINGSTATE.LOGGING)
                {
                    if (mPausableLoggingTimer.Enabled == true)
                    {
                        mPausableLoggingTimer.Enabled = false;
                    }

                    mLogging.SetLoggingState(LOGGINGSTATE.PAUSED);
                    UserMessage.Content = "Media is Paused...";
                }

                //if (mJoystickAnnotate.GetButtonState() == ButtonState.BUTTON2PRESSED)
                //{
                //    mVideoPlayer.Play();
                //    return;
                //}

                if (mLevelChange.State != CHANGESTATE.UPDATED)
                {
                    mLevelChange.UpdateLevels(mLogging.mLogList);
                }

                if (LevelChangeHolder.Visibility == Visibility.Hidden)
                {
                    LevelChangeHolder.Visibility = Visibility.Visible;
                }
                return;
            }

            else if (mVideoPlayer.State == STATE.MEDIACHANGE)
            {
                UserMessage.Content = "Waiting for Media to load...";

                if (mVideoPlayer.ChangeMedia() == true)
                {
                    Media_Status.Source = new BitmapImage(new Uri("./images/UIX_02.png", UriKind.RelativeOrAbsolute));
                    mTimer.Stop();

                    if (mPausableLoggingTimer.Enabled == true)
                    {
                        mPausableLoggingTimer.Enabled = false;
                    }

                    mLogging.SetLoggingState(LOGGINGSTATE.NONE);
                    mLogging.Clear();
                    mLevelChange.Clear();

                    mStartupCheckTimer.Start();
                }
            }
            else if (mVideoPlayer.State == STATE.RESTARTED)
            {
                /* A CHANGE OF MEDIA IS REQUIRED */

                if (mPausableLoggingTimer.Enabled == true)
                {
                    mPausableLoggingTimer.Stop();
                }

                mLogging.SetLoggingState(LOGGINGSTATE.NONE);
                mLogging.Clear();
                mLevelChange.Clear();

                UserMessage.Content = "Media has been Restarted...";
                mVideoPlayer.State  = STATE.READY;
                mLocalState         = LOCALSTATE.READYTOPLAY;
            }

            else
            {
                mLogging.SetLoggingState(LOGGINGSTATE.NONE);
            }
        }