I am trying to create a timer for a Project class (multiple instances) which when elapsed will call a static method from another class (BuildEngine.AddBuild) to add itself (the project) to a build queue.
I get the following error:
Error 4 Method name expected
Build Engine Class:
// Set timers for builds
_Logger.Log("Scheduling Builds ...");
foreach (Project project in _ProjectList)
{
switch (project.TriggerType)
{
case "Scheduled":
TimeSpan nowTime = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, 0);
TimeSpan projectTime = project.Time;
project.ProjectTimer = new Timer(nowTime.Subtract(projectTime).TotalMilliseconds);
project.ProjectTimer.Elapsed += new ElapsedEventHandler(BuildEngine.AddBuild(project));
project.ProjectTimer.AutoReset = true;
project.ProjectTimer.Enabled = true;
break;
case "Continuous":
break;
}
}
BuildEngine.AddBuild():
public static void AddBuild(Project project)
{
Build build = new Build();
build.Project = project;
build.BuildNumber = -1;
build.BuildStatus = BuildStatus.NotBuilding;
_BuildQueue.Add(build);
}