using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.IO; using System.Linq; using System.ServiceProcess; using System.Text; using System.Threading.Tasks;
namespace WinServiceTest { public partial class Service1 : ServiceBase { public Service1() { InitializeComponent();
System.Timers.Timer timer = new System.Timers.Timer(); timer.Elapsed += new System.Timers.ElapsedEventHandler(TimedEvent); timer.Interval = 5000;//每5秒执行一次 timer.Enabled = true; } public int count = 0; //定时执行事件 private void TimedEvent(object sender, System.Timers.ElapsedEventArgs e) { //业务逻辑代码 EmailClass mail = new EmailClass();
//计算周围有几颗雷 function checkCount(id) { //$("#clickLenard").append('<p>鼠标左键点击了:' + id + '</p>');
var arr = [-x - 1, -x, -x + 1, -1, 1, x - 1, x, x + 1]; var sum = 0; for (var i = 0; i < arr.length; i++) { var temp = (parseInt(id) + arr[i]); if (temp <= 0) continue; if (temp > x * y) continue; if (id % x == 1 && (i == 0 || i == 3 || i == 5)) continue; if (id % x == 0 && (i == 2 || i == 4 || i == 7)) continue; var a = $("#" + temp).length > 0 ? 0 : 1; sum += a; //$("#clickLenard").append('<p>周围:' + temp + "-->>" + a + "" + '</p>'); } return sum; }
//显示所有的地雷 function bobobo() { for (var i = 1; i <= x * y;) { var id = "#-" + i; $(id).addClass("zhadang"); i++ } }
/*计时开始*/ var times; function myclock() { var t = $("#time").val(); t = t.substring(0, t.length - 2); t = 1 + Number(t) + 'ms'; $("#time").attr('value', t); times = setTimeout("myclock()", 100); } </script>