public partial class ScheduledService : ServiceBase { //TimerCallback timer = new TimerCallback(DBMethod); System.Timers.Timer timer = new System.Timers.Timer(); public ScheduledService() { InitializeComponent(); } protected override void OnStart(string[] args) { // TraceService("start service"); //handle Elapsed event timer.Elapsed += new ElapsedEventHandler(OnElapsedTime); // ////This statement is used to set interval to 1 minute (= 60,000 milliseconds) timer.Interval = 1000; // ////enabling the timer timer.Enabled = true; try { Process p = new Process(); p.StartInfo.WorkingDirectory = @"C:\Documents\Visual Studio 2010\Projects\palindrome\palindrome\bin\Debug"; p.StartInfo.FileName = "palindrome.exe"; p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; // Change as needed p.Start(); p.WaitForExit(300000); // Synchronous timed wait } catch (Exception ex) { // throw new ApplicationException(string.Format("Unable to start process: {0}\r\nException:{1}", processExecutable, ex.Message)); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)