예제 #1
0
파일: Form1.cs 프로젝트: PLS54/CSharpCode
        private void HandleTransitionCompleted(object sender, TransitionCompletedEventArgs e)
        {
            TimerUtil.TraceAndDebugMessage(string.Format("Transition Completed at {0}:\tState ID: {1}\tEvent ID: {2}",
                                                         DateTime.Now,
                                                         ((CurlingTimmerStateMachine.StateID)(e.StateID)).ToString(),
                                                         ((CurlingTimmerStateMachine.EventID)(e.EventID)).ToString()), 1);
            switch ((CurlingTimmerStateMachine.StateID)e.StateID)
            {
            case CurlingTimmerStateMachine.StateID.TimingTeam1:
            case CurlingTimmerStateMachine.StateID.TimingTeam2:
                ProcessTimingTeamsEvents();
                break;

            case CurlingTimmerStateMachine.StateID.WaitingForRockReset:
                ProcessWaitingForRockResetEvents();
                break;

            case CurlingTimmerStateMachine.StateID.TimingBetweenEnds:
                ProcessTimingBetweenEndsEvents();
                break;

            case CurlingTimmerStateMachine.StateID.TimeOutDuringEnd:
                ProcessTimeOutDuringEndEvents();
                break;

            case CurlingTimmerStateMachine.StateID.EndOfGame:
                ProcessEndOfGameEvents();
                break;
            }
        }
예제 #2
0
 void _stateMachine_TransitionCompleted(object sender, TransitionCompletedEventArgs <NaoState, NaoCommand> e)
 {
     this._logger.InfoFormat("Transition completed. Current state: {0}, new state: {1}, command: {2}.", e.StateId.ToString(), e.NewStateId.ToString(), e.EventId.ToString());
     if (!this._forcedStop)
     {
         this.CurrentState = e.NewStateId;
     }
 }
예제 #3
0
        private void OnTransitionCompleted(IntPtr cubeTransition, IntPtr cubeTexture)
        {
            TransitionCompletedEventArgs e = new TransitionCompletedEventArgs();

            // Populate all members of "e" (TransitionCompletedEventArgs) with real data
            //e.CubeTransitionEffect = Registry.GetManagedBaseHandleFromNativePtr(cubeTransition) as CubeTransitionEffect;

            if (_transitionCompletedEventHandler != null)
            {
                //here we send all data to user event handlers
                _transitionCompletedEventHandler(this, e);
            }
        }
예제 #4
0
        private void HandleTransitionCompleted(object sender, TransitionCompletedEventArgs <StateID, EventID, EventArgs> e)
        {
            if (e.Error != null)
            {
                MessageBox.Show(e.Error.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            switch (e.TargetStateID)
            {
            case StateID.Off:
                currentPictureBox.Hide();
                offPictureBox.Show();
                currentPictureBox = offPictureBox;

                currentUmlPictureBox.Hide();
                umlOffPictureBox.Show();
                currentUmlPictureBox = umlOffPictureBox;
                break;

            case StateID.Red:
                currentPictureBox.Hide();
                redPictureBox.Show();
                currentPictureBox = redPictureBox;

                currentUmlPictureBox.Hide();
                umlRedPictureBox.Show();
                currentUmlPictureBox = umlRedPictureBox;
                break;

            case StateID.Yellow:
                currentPictureBox.Hide();
                yellowPictureBox.Show();
                currentPictureBox = yellowPictureBox;

                currentUmlPictureBox.Hide();
                umlYellowPictureBox.Show();
                currentUmlPictureBox = umlYellowPictureBox;
                break;

            case StateID.Green:
                currentPictureBox.Hide();
                greenPictureBox.Show();
                currentPictureBox = greenPictureBox;

                currentUmlPictureBox.Hide();
                umlGreenPictureBox.Show();
                currentUmlPictureBox = umlGreenPictureBox;
                break;
            }
        }
예제 #5
0
        private void HandleTransitionCompleted(object sender, TransitionCompletedEventArgs e)
        {
            Console.WriteLine("Transition Completed:");
            Console.WriteLine("\tState ID: {0}", ((StateID)(e.StateID)));
            Console.WriteLine("\tEvent ID: {0}", ((EventID)(e.EventID)));

            if (e.Error != null)
            {
                Console.WriteLine("\tException: {0}", e.Error.Message);
            }
            else
            {
                Console.WriteLine("\tException: No exception was thrown.");
                switch (e.StateID)
                {
                case (int)StateID.Idle:
                    Console.WriteLine(@"Idle State.");
                    break;

                case (int)StateID.CheckRequest:
                    Console.WriteLine(@"Check Request State.");
                    if (PrvRequestArray.Count != 0)
                    {
                        Send((int)EventID.RemainRequest, PrvRequestArray[0]);
                    }
                    else
                    {
                        Send((int)EventID.EndOfRequest);
                    }
                    break;
                }
            }

            if (e.ActionResult != null)
            {
                Console.WriteLine("\tAction Result: {0}", e.ActionResult);
            }
            else
            {
                Console.WriteLine("\tAction Result: No action result.");
            }
        }
예제 #6
0
        /// <summary>
        /// State machine transaction completed event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void _stateMachine_TransitionCompleted(object sender, TransitionCompletedEventArgs <NaoState, NaoCommand> e)
        {
            this._logger.InfoFormat("[Robot: {0}] - Transition completed. Current state: {1}, new state: {2}, command: {3}.", _connection.IP, e.StateId.ToString(), e.NewStateId.ToString(), e.EventId.ToString());
            if (!this._forcedStop)
            {
                this.CurrentState = e.NewStateId;
            }
            this.CurrentExecutingCommand = null;

            // check if the last state and set robot status to finished
            if (e.NewStateId == this.StateCommands.GetItem(this.StateCommands.Count - 1).Key)
            {
                this.Status = RobotStatus.Finished;
            }

            // raise event
            if (this.RobotStateChanged != null)
            {
                this.RobotStateChanged(this, null);
            }
        }
예제 #7
0
        private static void HandleTransitionCompleted(object sender, TransitionCompletedEventArgs <StateID, EventID, EventArgs> e)
        {
            Console.WriteLine("Transition Completed:");
            Console.WriteLine("\tState ID: {0}", e.TargetStateID);
            Console.WriteLine("\tEvent ID: {0}", e.EventID);

            if (e.Error != null)
            {
                Console.WriteLine("\tException: {0}", e.Error.Message);
            }
            else
            {
                Console.WriteLine("\tException: No exception was thrown.");
            }

            if (e.ActionResult != null)
            {
                Console.WriteLine("\tAction Result: {0}", e.ActionResult);
            }
            else
            {
                Console.WriteLine("\tAction Result: No action result.");
            }
        }
예제 #8
0
        private static void HandleTransitionCompleted(object sender, TransitionCompletedEventArgs<StateID, EventID, EventArgs> e)
        {
            Console.WriteLine("Transition Completed:");
            Console.WriteLine("\tState ID: {0}", e.TargetStateID);
            Console.WriteLine("\tEvent ID: {0}", e.EventID);

            if (e.Error != null)
            {
                Console.WriteLine("\tException: {0}", e.Error.Message);
            }
            else
            {
                Console.WriteLine("\tException: No exception was thrown.");
            }

            if (e.ActionResult != null)
            {
                Console.WriteLine("\tAction Result: {0}", e.ActionResult);
            }
            else
            {
                Console.WriteLine("\tAction Result: No action result.");
            }
        }
예제 #9
0
 public void OnScreenTransition(TransitionCompletedEventArgs args)
 {
     ScreenTransitionListener(args);
 }
예제 #10
0
 private void transition_TransitionCompleted(object sender, TransitionCompletedEventArgs e)
 {
     count++;
     if (count == transitions.Length + 1)
         OnTransitionCompleted(newPage, oldPage);
 }
예제 #11
0
        private void HandleTransitionCompleted(object sender, TransitionCompletedEventArgs<StateID, EventID, EventArgs> e)
        {
            if (e.Error != null)
            {
                MessageBox.Show(e.Error.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            switch (e.TargetStateID)
            {
                case StateID.Off:
                    currentPictureBox.Hide();
                    offPictureBox.Show();
                    currentPictureBox = offPictureBox;

                    currentUmlPictureBox.Hide();
                    umlOffPictureBox.Show();
                    currentUmlPictureBox = umlOffPictureBox;
                    break;

                case StateID.Red:
                    currentPictureBox.Hide();
                    redPictureBox.Show();
                    currentPictureBox = redPictureBox;

                    currentUmlPictureBox.Hide();
                    umlRedPictureBox.Show();
                    currentUmlPictureBox = umlRedPictureBox;
                    break;

                case StateID.Yellow:
                    currentPictureBox.Hide();
                    yellowPictureBox.Show();
                    currentPictureBox = yellowPictureBox;

                    currentUmlPictureBox.Hide();
                    umlYellowPictureBox.Show();
                    currentUmlPictureBox = umlYellowPictureBox;
                    break;

                case StateID.Green:
                    currentPictureBox.Hide();
                    greenPictureBox.Show();
                    currentPictureBox = greenPictureBox;

                    currentUmlPictureBox.Hide();
                    umlGreenPictureBox.Show();
                    currentUmlPictureBox = umlGreenPictureBox;
                    break;
            }
        }
예제 #12
0
 private void FluentBrush_TransitionCompleted(object sender, TransitionCompletedEventArgs args)
 {
     AssociatedObject?.SetValue(BackgroundProperty, args.NewBrush);
 }