I am writing an app, still, where I need to test some devices every minute for 30 minutes. It made sense to use a timer set to kick off every 60 secs and do whats required in the event handler.
However, I need the app to wait for the 30 mins until I have finished with the timer since the following code alters the state of the devices I am trying to monitor.
I obviously don't want to use any form of loop to do this. I thought of using another windows form, since I also display the progress, which will simply kick off the timer and wait until its complete.
The problem I am having with this is that I use a device Class and cant seem to get access to the methods in the device class from the 2nd (3rd actually - see below) windows form.
I have an initial windows form where I get input from the user, then call the 2nd windows form where it work out which tests need to be done and which device classes need to be used, and then I want to call the 3rd windows form to handle the timer.
I will have up to 6-7 device classes and so wanted to only instantiate them when actually requiring them, from the 2nd form.
Should I have put this logic into the 1st windows form (program class ??) ?
Would I not still have the problem of not being able to access device class methods from there too ?
Anyway, perhaps someone knows of a better way to do the checks every minute without the rest of the code executing (and changing the status of the devices) or how I should be accessing the methods in the app ??
Well that's the problem, I cant get that part of it to work correctly.
Here is the definition for the calling form including the device class -
namespace NdtStart
{
public partial class fclsNDTCalib : Form
{
NDTClass NDT = new NDTClass();
public fclsNDTCalib()
(new fclsNDTTicker(NDT)).ShowDialog();
Here is the class def for the called form -
namespace NdtStart
{
public partial class fclsNDTTicker : Form
{
public fclsNDTTicker()
I tried lots but couldn't get the arguments to work.