Exemplo n.º 1
0
        /// <summary>
        /// Called when the timezone offset changes
        /// </summary>
        /// <param name="offset"></param>
        public void TimeZoneOffsetChanged(double offset)
        {
            double localOffset = GetLocalTimeZoneOffset();

            AbstractGuiController.GetController().SetActiveTimeZoneForDisplay(offset + localOffset);
            TimeFetcher.setOffset(offset);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor: initializes snoozeUntilTime to harmless value
 /// </summary>
 public AlarmController()
 {
     this.alarmList       = new List <Alarm>();
     this.audioController = AbstractAudioController.GetController();
     this.guiController   = AbstractGuiController.GetController();
     this.snoozeUntilTime = TimeFetcher.getCurrentTime();
 }
Exemplo n.º 3
0
        /// <summary>
        /// snooze alarms from being able to ring for snoozePeriod_minutes
        /// </summary>
        public void SnoozeRequested()
        {
            DateTime now = TimeFetcher.getCurrentTime();

            if (!CheckIfSnoozeOver(now))
            {
                //dont start a new snooze if things are still snoozing
                return;
            }


            updateSnoozeUntilTime(now);
            guiController.SetSnoozeAvailable(false);
            guiController.SetDismissAvailable(false);

            //iterate over each alarm and if it is ringing, tell it to snooze
            foreach (Alarm alarm in alarmList)
            {
                if (alarm.IsRinging)
                {
                    alarm.Status = AlarmState.Off;
                    guiController.UpdateAlarm(alarm);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// The pulse event, calls time pulse on each listener
        /// </summary>
        private void Timer_Tick()
        {
            //grab the time from the time fetcher
            DateTime currentTime = TimeFetcher.getCurrentTime();

            //call time pulse on each listener
            foreach (TimeListener listener in listeners)
            {
                listener.TimePulse(currentTime);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Sets this alarm for either hour:minute today, or if it has already passed, hour:minute tomorrow
        /// </summary>
        /// <param name="hour">The hour of day this alarm goes off at</param>
        /// <param name="minute">The minute of day this alarm goes off at</param>
        private void SetAlarmForNextOccurenceOf(int hour, int minute)
        {
            //get the current time
            DateTime now = TimeFetcher.getCurrentTime();

            //create an alarm at hour:minute today
            alarmTime = new DateTime(now.Year, now.Month, now.Day, hour, minute, 0, DateTimeKind.Local);
            //if that time has already passed move it up one day
            if (alarmTime <= now)
            {
                AddOneDayToAlarm();
            }
        }
Exemplo n.º 6
0
 public void ManualDateRequested(int year, int month, int day)
 {
     TimeFetcher.SetNewDate(year, month, day);
 }
Exemplo n.º 7
0
 public void ManualTimeRequested(int hours, int minutes)
 {
     TimeFetcher.SetNewTime(hours, minutes);
 }