1

I need a task to run every 60 seconds to go out and fetch data from a web api. Once the data comes back it will process the data which should not freeze the gui when processing. Is there a way to do this using electron.net?

Luke101
  • 63,072
  • 85
  • 231
  • 359

2 Answers2

1

Yes, in order to do that you must make this task in another thread, one way to do that is to use Microsoft BackgroundWorker (https://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker(v=vs.110).aspx).

Leonardo Menezes
  • 496
  • 5
  • 11
  • 1
    actually the solution needs to be cross platform – Luke101 Apr 09 '18 at 21:06
  • BackgroundWorker exists for almost all platforms, are you looking for some specific platform that i can help you with? Take a look at the link below, it describes all platforms that support BackgroundWorker: https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.backgroundworker?view=netframework-4.7.2 – Leonardo Menezes Apr 10 '18 at 01:37
0

Another potential here would be to use a Task, then provide a CancellationToken to it so that during program shut-down, you can dispose of the Task gracefully.

Richard B
  • 1,581
  • 1
  • 15
  • 31