Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.Timers.Timer statustimer =
- new System.Timers.Timer(
- double.Parse(ConfigurationManager.AppSettings["NotificationSendPeriod"]));
- statustimer.Elapsed += ((sender, eventArgs) =>
- {
- try
- {
- ProcessData();
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- }
- });
- statustimer.Enabled = true; Console.ReadLine();
- public static async Task<bool> ProcessData()
- {
- try
- {
- new Thread(() =>
- {
- // Do work here
- }).Start();
- return true;
- }
- catch (Exception exception)
- {
- Console.WriteLine(exception);
- _logInstance?.Error(exception, $"{exception.Message}n{exception.StackTrace}");
- return false;
- }
- }
Add Comment
Please, Sign In to add comment