Right click on the Script Module and Rename it to "TimerScript".
The Script Module will default with the following code.
Code: Select all
namespace Neo.ApplicationFramework.Generated
{
using System.Windows.Forms;
using System;
using System.Drawing;
using Neo.ApplicationFramework.Tools;
using Neo.ApplicationFramework.Common.Graphics.Logic;
using Neo.ApplicationFramework.Controls;
using Neo.ApplicationFramework.Interfaces;
public partial class TimerScript
{
}
}
Code: Select all
public partial class TimerScript
{
private static Timer timer1 = null;
private static Timer timer2 = null;
static TimerScript()
{
timer1 = new Timer();
timer1.Tick += new EventHandler(TimeOut1);
timer1.Interval = 1000;
timer1.Enabled = true;
timer2 = new Timer();
timer2.Tick += new EventHandler(TimeOut2);
timer2.Interval = 250;
timer2.Enabled = true;
}
public static void Stop()
{
try {
timer1.Enabled = false;
timer2.Enabled = false;
}
catch(Exception) {}
}
public static void Start()
{
try {
timer1.Enabled = true;
timer2.Enabled = true;
}
catch(Exception) {}
}
private static void TimeOut1(Object myObject, EventArgs myEventArgs)
{
Globals.Tags.Tag1.Value = Globals.Tags.Tag1.Value + 1;
}
private static void TimeOut2(Object myObject, EventArgs myEventArgs)
{
Globals.Tags.Tag2.Value = Globals.Tags.Tag2.Value + 1;
}
}