more G-Labs products

Author Topic: Confused - main and startup  (Read 1078 times)

March 23, 2016, 03:06:58 PM
Read 1078 times

mchias13

  • **
  • Information
  • Jr. Member
  • Posts: 45
I'm diving into the coding part of homegenie.  I'm having issues with having my program run consistently.  It only seems to be run if I compile and click run.  My assumption is homegenie runs like a PLC, constantly checking the running programs in order.  Please correct me if I'm wrong.

My confusion comes in in when is the Startup code actually run?  Is it run once? Every time the server calls the program? Once a program is running does it then ignore the startup code?

I put Program.Run() in my startup and Program.GoBackground() at the end of my main.

March 24, 2016, 12:15:31 AM
Reply #1

mchias13

  • **
  • Information
  • Jr. Member
  • Posts: 45
So i just tried this code->

in startup:
var onTime = "*/2 * * * *";

if (Scheduler.IsScheduling(onTime))
   Program.Run();

in main section:
Program.Notify("Test Program", "main");
Pause(2);
Program.GoBackground();


I don't get the pop up notification.  Please help I'm lost. 

edited my code for */2 to repeat every 2 minutes.
« Last Edit: March 24, 2016, 01:23:29 AM by mchias13 »

March 24, 2016, 03:53:58 PM
Reply #2

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525