예제 #1
0
        /// <summary>
        /// Validates the data, correcting automatically as required
        /// </summary>
        public void Sanitize()
        {
            if (BellVolumePercent < 0)
            {
                BellVolumePercent = 0;
            }

            if (BellVolumePercent > 100)
            {
                BellVolumePercent = 100;
            }

            if (AnalogueClockWidthPercent < 0 || AnalogueClockWidthPercent > 100)
            {
                AnalogueClockWidthPercent = 50;
            }

            if (HttpServerPort < DefaultPort || HttpServerPort > DefaultPort + MaxPossiblePorts)
            {
                HttpServerPort = DefaultPort;
            }

            var persistDurations = GetPersistDurationItems().ToArray();

            if (persistDurations.FirstOrDefault(x => x.Seconds == PersistDurationSecs) == null)
            {
                PersistDurationSecs = persistDurations[persistDurations.Length / 2].Seconds;
            }

            MeetingStartTimes.Sanitize();
        }
        private void UpdateMeetingTimes(bool updateStartTimes)
        {
            if (SelectedDate != null && SelectedArea != null)
            {
                DateTime first = SelectedDate.AddHours(SelectedArea.morningstarts.HasValue ? SelectedArea.morningstarts.Value : 7).AddMinutes(SelectedArea.morningstarts_minutes.HasValue ? SelectedArea.morningstarts_minutes.Value : 0);
                DateTime last  = SelectedDate.AddHours(SelectedArea.eveningends.HasValue ? SelectedArea.eveningends.Value : 7).AddMinutes(SelectedArea.eveningends_minutes.HasValue ? SelectedArea.eveningends_minutes.Value : 0);
                DateTime current;
                int      count = 0;

                if (updateStartTimes)
                {
                    MeetingStartTimes.Clear();
                }
                else
                {
                    first = MeetingStart;
                }

                current = first;
                MeetingEndTimes.Clear();
                if (current.Date != last.Date)
                {
                    last = current.Date + last.TimeOfDay;
                }

                while ((current < last) && (count < 48))
                {
                    count++;
                    if (updateStartTimes)
                    {
                        MeetingStartTimes.Add(current);
                    }

                    current = current.AddMinutes(30);
                    MeetingEndTimes.Add(new EndTime()
                    {
                        Value = current, Start = first
                    });
                }
            }
        }
예제 #3
0
파일: Options.cs 프로젝트: thinidus/OnlyT
        /// <summary>
        /// Validates the data, correcting automatically as required
        /// </summary>
        public void Sanitize()
        {
            if (BellVolumePercent < 0)
            {
                BellVolumePercent = 0;
            }

            if (BellVolumePercent > 100)
            {
                BellVolumePercent = 100;
            }

            if (AnalogueClockWidthPercent < 0 || AnalogueClockWidthPercent > 100)
            {
                AnalogueClockWidthPercent = 50;
            }

            if (HttpServerPort < DefaultPort || HttpServerPort > DefaultPort + MaxPossiblePorts)
            {
                HttpServerPort = DefaultPort;
            }

            MeetingStartTimes.Sanitize();
        }