Exemplo n.º 1
0
        public int CompareTo(object obj)
        {
            if (!(obj is WeeklyScheduleElement))
            {
                throw new ArgumentException(string.Format("Cannot compare WeeklyScheduledElement to {0}.", obj.GetType()));
            }
            WeeklyScheduleElement other = (WeeklyScheduleElement)obj;

            if (RunTime > other.RunTime)
            {
                return(1);
            }
            if (RunTime < other.RunTime)
            {
                return(-1);
            }
            return(0);
        }
Exemplo n.º 2
0
        private WeeklyScheduleElement CreateWeeklyScheduleElement(LightState state, ScheduleElement e, int day)
        {
            Command cmd = new Command()
            {
                LightState = state,
                Ramp       = e.Ramp,
                LightIds   = new List <string>(lightingGroups[e.Lights]),
                Brightness = e.Brightness,
                Colour     = e.Colour
            };

            if (cmd.Ramp != 0)
            {
                cmd.Brightness = 254;
            }
            WeeklyScheduleElement element = new WeeklyScheduleElement()
            {
                Command = cmd,
                Name    = e.Name,
                RunTime = SecondsSinceStartOfWeek(day, (DateTime)(state == LightState.On ? e.On : e.Off))
            };

            return(element);
        }
Exemplo n.º 3
0
 internal WeeklyScheduleElement(WeeklyScheduleElement source)
 {
     RunTime = source.RunTime;
     Name    = source.Name;
     Command = new Command(source.Command);
 }