private CustomTimer[] CreateAndStartTimers() { var timerSettings = TimerSettings.CreateFromAppSettings(); var balloonTipAdapter = new NotifyIconBalloonTipAdapter(_notify); var timers = TimerSettings.CreateTimers(timerSettings, balloonTipAdapter).ToArray(); foreach (var timer in timers) { timer.Start(); } return(timers); }
public static IEnumerable<TimerSettings> CreateFromAppSettings() { var appSettingEntries = ReadAppSettingEntries(); var settings = new List<TimerSettings>(); foreach (var entry in appSettingEntries) { var elements = entry.Split(';'); var startTimeElement = elements.ElementAt(0); var intervalElement = elements.ElementAt(1); var intervalUnitElement = elements.ElementAt(2); var headerElement = elements.ElementAt(3); var textElement = elements.ElementAt(4); var startTime = ParseAndValidateStartTime(startTimeElement); var interval = ParseAndValidateInterval(intervalElement); var intervalUnit = ParseAndValidateIntervalUnit(intervalUnitElement); var intervalInMilliseconds = TimeConverters.GetMillisecondsForIntervalUnit(intervalUnit, interval); var headerText = ParseAndValidateHeaderText(headerElement); var text = ParseAndValidateText(textElement); var settingEntry = new TimerSettings { StartTime = startTime, IntervalInMs = intervalInMilliseconds, IntervalRaw = interval, Header = headerText, Text = text, IntervalUnit = intervalUnit }; settings.Add(settingEntry); } return settings; }
public static IEnumerable <TimerSettings> CreateFromAppSettings() { var appSettingEntries = ReadAppSettingEntries(); var settings = new List <TimerSettings>(); foreach (var entry in appSettingEntries) { var elements = entry.Split(';'); var startTimeElement = elements.ElementAt(0); var intervalElement = elements.ElementAt(1); var intervalUnitElement = elements.ElementAt(2); var headerElement = elements.ElementAt(3); var textElement = elements.ElementAt(4); var startTime = ParseAndValidateStartTime(startTimeElement); var interval = ParseAndValidateInterval(intervalElement); var intervalUnit = ParseAndValidateIntervalUnit(intervalUnitElement); var intervalInMilliseconds = TimeConverters.GetMillisecondsForIntervalUnit(intervalUnit, interval); var headerText = ParseAndValidateHeaderText(headerElement); var text = ParseAndValidateText(textElement); var settingEntry = new TimerSettings { StartTime = startTime, IntervalInMs = intervalInMilliseconds, IntervalRaw = interval, Header = headerText, Text = text, IntervalUnit = intervalUnit }; settings.Add(settingEntry); } return(settings); }
public CustomTimer(TimerSettings settings) : base(settings.IntervalInMs) { Settings = settings; }
public CustomTimer(TimerSettings settings) : base(settings.IntervalInMs) { Settings = settings; }