Пример #1
0
        void HandleStateChanged(object sender, TimerStateChangedEventArgs e)
        {
            switch (e.Transition)
            {
            //case TimerStateTransition.ReadyToSprint:
            //    break;
            //case TimerStateTransition.SprintToReady:
            //    break;
            //case TimerStateTransition.SprintToHomeStraight:
            //    break;
            //case TimerStateTransition.HomeStraightToReady:
            //    break;
            case TimerStateTransition.HomeStraightToBreak:
                _player.Open(_alarmSound);
                _player.Play();
                break;

            //case TimerStateTransition.BreakToReady:
            //    break;
            //case TimerStateTransition.BreakToBreakOverrun:
            //    break;
            //case TimerStateTransition.BreakOverrunToReady:
            //    break;
            default:
                break;
            }
        }
Пример #2
0
 void Timer_StateChanged(object sender, TimerStateChangedEventArgs e)
 {
     switch (e.Transition)
     {
         case TimerStateTransition.ReadyToSprint:
             Trace.WriteLine(string.Format("Sprint started with activity: {0}", Timer.CurrentActivity.Name));
             break;
         case TimerStateTransition.SprintToReady:
             Trace.WriteLine("Sprint aborted");
             break;
         case TimerStateTransition.SprintToHomeStraight:
             Trace.WriteLine("Sprint entered home straight phase");
             break;
         case TimerStateTransition.HomeStraightToReady:
             Trace.WriteLine("Sprint aborted in home straight phase");
             break;
         case TimerStateTransition.HomeStraightToBreak:
             Trace.WriteLine("Sprint finished");
             break;
         case TimerStateTransition.BreakToReady:
             Trace.WriteLine("Break aborted");
             break;
         case TimerStateTransition.BreakToBreakOverrun:
             Trace.WriteLine("Break reached its maximum");
             break;
         case TimerStateTransition.BreakOverrunToReady:
             Trace.WriteLine("Break finished");
             break;
         default:
             break;
     }
 }
Пример #3
0
        private void HandleStateChanged(object sender, TimerStateChangedEventArgs e)
        {
            if (IsClientValid())
            {
                try
                {
                    switch (e.Transition)
                    {
                    case TimerStateTransition.ReadyToSprint:
                        CreateSnapshot();
                        var finishTime   = DateTime.Now + Timer.SprintDuration;
                        var personalNote = string.Format("I'm working till {0} on: {1}",
                                                         finishTime.ToShortTimeString(), Timer.CurrentActivity.Name);
                        var availability = Timer.CurrentActivity.Tags.Any(t => t.Name == "dnd")
                                                   ? ContactAvailability.Busy
                                                   : _snapshotAvailability;
                        SetStatus(availability, personalNote);
                        break;

                    case TimerStateTransition.SprintToReady:
                        RestoreFromSnapshot();
                        break;

                    case TimerStateTransition.SprintToHomeStraight:
                        break;

                    case TimerStateTransition.HomeStraightToReady:
                        RestoreFromSnapshot();
                        break;

                    case TimerStateTransition.HomeStraightToBreak:
                        RestoreFromSnapshot();
                        break;

                    case TimerStateTransition.BreakToReady:
                        break;

                    case TimerStateTransition.BreakToBreakOverrun:
                        break;

                    case TimerStateTransition.BreakOverrunToReady:
                        break;
                    }
                }
                // Catch NullReferenceException which is thrown when client get disconnected
                catch (NullReferenceException)
                {
                }
            }
        }
Пример #4
0
        void Timer_StateChanged(object sender, TimerStateChangedEventArgs e)
        {
            switch (e.Transition)
            {
            case TimerStateTransition.ReadyToSprint:
                Trace.WriteLine(string.Format("Sprint started with activity: {0}", Timer.CurrentActivity.Name));
                break;

            case TimerStateTransition.SprintToReady:
                Trace.WriteLine("Sprint aborted");
                break;

            case TimerStateTransition.SprintToHomeStraight:
                Trace.WriteLine("Sprint entered home straight phase");
                break;

            case TimerStateTransition.HomeStraightToReady:
                Trace.WriteLine("Sprint aborted in home straight phase");
                break;

            case TimerStateTransition.HomeStraightToBreak:
                Trace.WriteLine("Sprint finished");
                break;

            case TimerStateTransition.BreakToReady:
                Trace.WriteLine("Break aborted");
                break;

            case TimerStateTransition.BreakToBreakOverrun:
                Trace.WriteLine("Break reached its maximum");
                break;

            case TimerStateTransition.BreakOverrunToReady:
                Trace.WriteLine("Break finished");
                break;

            default:
                break;
            }
        }