private void makeActive_tick(object sender, EventArgs e) { if (NineToFive.IsChecked.HasValue && NineToFive.IsChecked.Value) { var time = DateTime.Now; if (TimeSpan.Compare(time.TimeOfDay, TimeSpan.FromHours(9)) > 0 && TimeSpan.Compare(time.TimeOfDay, TimeSpan.FromHours(17)) < 0) { InputSimulator.SimulateInput(); } } else { InputSimulator.SimulateInput(); } }