protected override void OnStart(string[] args) { // TODO: Add code here to start your service. using (ServiceConnector request = new ServiceConnector()) { System.Threading.Timer oTimer1; TimerCallback timerDelegate1 = new TimerCallback(request.ProcessImportRecipients); oTimer1 = new System.Threading.Timer(timerDelegate1, "true", 0, System.Threading.Timeout.Infinite); } }
private void OnElapsedTime(object source, ElapsedEventArgs e) { time.Enabled = false; // Run system code here using (ServiceConnector request = new ServiceConnector()) { request.EmailSentCount(true); } time.Interval = 1000; time.Enabled = true; }
protected override void OnStart(string[] args) { // TODO: Add code here to start your service. using (ServiceConnector Connector = new ServiceConnector()) { //System.Threading.Timer oTimer1; //TimerCallback timerDelegate1 = new TimerCallback(Connector.EmailSentCount); //oTimer1 = new System.Threading.Timer(timerDelegate1, "true", 0, System.Threading.Timeout.Infinite); time.Elapsed += new ElapsedEventHandler(OnElapsedTime); time.Interval = 1000; time.Enabled = true; //System.Threading.Timer Timer2; //TimerCallback timerDelegate2 = new TimerCallback(Connector.ClientStatus); //Timer2 = new System.Threading.Timer(timerDelegate2, "true", 0, System.Threading.Timeout.Infinite); } }