示例#1
0
 protected override void OnStart(string[] args)
 {
     _timer1.AutoReset = true;
     _timer1.Enabled   = true;
     SendMailService.WriteErrorLog("Service started");
     SendMailService.SendEmail(ServiceProperty.Email, "Service Report", $"Service has been is started on {Environment.MachineName} on {DateTime.Now.ToLongTimeString()}.");
 }
示例#2
0
 protected override void OnStop()
 {
     _timer1.AutoReset = false;
     _timer1.Enabled   = false;
     SendMailService.WriteErrorLog("Service stopped");
     SendMailService.SendEmail(ServiceProperty.Email, "Service Report", $"Service on {Environment.MachineName} has been stopped on {DateTime.Now.ToLongTimeString()}.");
 }
示例#3
0
        // For Laptop
        protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus)
        {
            if (powerStatus.HasFlag(PowerBroadcastStatus.Suspend))
            {
                SendMailService.WriteErrorLog("System has been shutdown.");
                SendMailService.SendEmail(ServiceProperty.Email, "Service Report", "Your system has been down on " + DateTime.Now.ToLongTimeString());
            }

            return(true);
        }
示例#4
0
        private void ServiceTimer_Tick(object sender, ElapsedEventArgs e)
        {
            string msg = GetRssFeed();

            if (!string.IsNullOrEmpty(msg))
            {
                SendMailService.SendEmail(ServiceProperty.Email, "Today's Quote", msg);
            }
            if (GetCallType != 1)
            {
                return;
            }
            _timer1.Stop();
            System.Threading.Thread.Sleep(1000000);
            SetTimer();
        }
示例#5
0
 protected override void OnShutdown()
 {
     SendMailService.WriteErrorLog("System has been shutdown.");
     SendMailService.SendEmail(ServiceProperty.Email, "Service Report", $"{Environment.MachineName} went down on {DateTime.Now.ToLongTimeString()}");
 }