0

I am trying to create a background service or Windows service to regulate time. I have searched but need a thorough explanation on the differences.

I want to create an action that happens within a time interval. ie. I want to create a label that stays green from 3:00 pm till 5:00 am, then changes back to black after the time interval.

This is the image of what i am trying to do: as you can see the "Open now" is green because the time is set for the label to be green.

Aidan Fitzpatrick
  • 1,950
  • 1
  • 21
  • 26

1 Answers1

0

Windows service are also called background Service. Windows Services are a core component of the Microsoft Windows operating system and enable the creation and management of long-running processes.

Unlike regular software that is launched by the end user and only runs when the user is logged on, Windows Services can start without user intervention and may continue to run long after the user has logged off. The services run in the background and will usually kick in when the machine is booted. Developers can create Services by creating applications that are installed as a Service, an option ideal for use on servers when long-running functionality is needed without interference with other users on the same system.

Hamza Haider
  • 730
  • 6
  • 20
  • Thank you,but is there a way to perform an action within a timespan as stated in my question above.for example, from 3:00 pm to 5:00 pm a label should stay green , i have studied on timespan but i still cant get the answer. Thanks –  Nov 05 '18 at 10:37
  • You are welcome. This will helps you https://stackoverflow.com/questions/21299214/how-to-set-timer-to-execute-at-specific-time-in-c-sharp – Hamza Haider Nov 05 '18 at 11:14
  • Thank you,I solved it. it was much easier than i anticipated i was thinking too far, i just had to use less than and greater than signs, for example if(datetime.now.hours >= mytime.hours && if datetime.now.hours < mysecondtime.hours ){ label.textcolor=color.green;} –  Nov 05 '18 at 12:38
  • Great!! Welcome – Hamza Haider Nov 05 '18 at 12:46