Start Data Logger automatically on bootup
Posted: Wed Dec 04, 2013 2:00 pm
Hi,
I am trying to figure out how to start my data log on startup of the application. Is there any way to access the Event Handler for the main program load? Or is there some internal system tag like a First Scan tag?
I have tried putting the log start in the opened event handler for my start up screen but I do not want it to start the logger every time that screen is access so I tried the following;
void Home_Screen1_Opened(System.Object sender, System.EventArgs e)
{
if(!Globals.OneWeekAt30SecondIntervals.IsEnabled && Globals.Tags.SystemTagUsedStoragePercent.Value < 90)
{
Globals.OneWeekAt30SecondIntervals.Start();
}
}
But of course this does not work because the .IsEnabled property is not the same as asking if it is currently logging. I know I could just have it start regardless everytime the Home_Screen_Opened is called but that is bad programming and I am not sure if the logger creates a new log or appends the existing one when the .Start() is called.
I come from a strong C# programming background so I may end up opening the program in Visual Studio and hacking in the call I want where I want but I was hoping there was an easy way to do this.
There should be setting in the data logger settings to enable on start instead of relying on putting a .Start() in somewhere. Even if there was a way to trigger it on establishing good communications with the Controller this would be acceptable but I would still need to condition so that it does not need to call the .Start() every time.
I am trying to figure out how to start my data log on startup of the application. Is there any way to access the Event Handler for the main program load? Or is there some internal system tag like a First Scan tag?
I have tried putting the log start in the opened event handler for my start up screen but I do not want it to start the logger every time that screen is access so I tried the following;
void Home_Screen1_Opened(System.Object sender, System.EventArgs e)
{
if(!Globals.OneWeekAt30SecondIntervals.IsEnabled && Globals.Tags.SystemTagUsedStoragePercent.Value < 90)
{
Globals.OneWeekAt30SecondIntervals.Start();
}
}
But of course this does not work because the .IsEnabled property is not the same as asking if it is currently logging. I know I could just have it start regardless everytime the Home_Screen_Opened is called but that is bad programming and I am not sure if the logger creates a new log or appends the existing one when the .Start() is called.
I come from a strong C# programming background so I may end up opening the program in Visual Studio and hacking in the call I want where I want but I was hoping there was an easy way to do this.
There should be setting in the data logger settings to enable on start instead of relying on putting a .Start() in somewhere. Even if there was a way to trigger it on establishing good communications with the Controller this would be acceptable but I would still need to condition so that it does not need to call the .Start() every time.