I'm developing a c# application that periodically sends message to a device.
First question : What is the best way to run a function that sends message periodically (every 1 second)?
Second question : Sometimes I want to stop periodic request, run a block of code, and start periodic request again. What is the best way to implement this mechanism?
It's clear that periodic request should run in another thread.
Before running "a block of code", stopping periodic request and starting again at the end of code block might be a solution but I want to implement something smart on periodic request side.