Ejemplo n.º 1
0
        private void buttonStartPing_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(textBoxPinGintervial.Text.Trim()))
            {
                PingTools.PingTools.sleepTime = System.Convert.ToInt32(textBoxPinGintervial.Text.Trim());
            }
            if (!string.IsNullOrEmpty(textBoxTimeOut.Text.Trim()))
            {
                PingTools.PingTools.setTimeout(System.Convert.ToInt32(textBoxTimeOut.Text.Trim()));
            }
            if (string.IsNullOrEmpty(textBoxIPs.Text.Trim()))
            {
                return;
            }
            ThreadPing tp = new ThreadPing();

            tp.startPingThread(textBoxIPs.Text.Trim());
        }
Ejemplo n.º 2
0
 //ServiceBase.Run注册完服务之后必须运行service.run不然服务无法启动。
 /// <summary>
 /// 应用程序的主入口点。
 /// </summary>
 static void Main(string[] args)
 {
     if (args == null || args.Length == 0)
     {
         Console.WriteLine("----------请重新输入参数后运行-----------------");
         Console.WriteLine("需要先注册服务:");
         Console.WriteLine("-i   注册服务");
         Console.WriteLine("-u   卸载服务");
         Trace.WriteLine("-d   调试服务");
         MessageBox.Show("-i   注册服务, -u   卸载服务 -d   调试服务.需要在命令行。");
         tp = new ThreadPing();
         Service.readAppconfig();
         tp.startPingThread(Service.getAppIPAdderssString());
         MessageBox.Show("------正在运行不要关闭,也不要点确定,注册服务请重新运行--------");
         ThreadPing.clear();
     }
     else
     {
         if ("-i".Equals(args[0]))
         {
             Exec("\"" + typeof(Program).Assembly.Location + "\"");
         }
         else if ("-u".Equals(args[0]))
         {
             Exec("-u \"" + typeof(Program).Assembly.Location + "\"");
         }
         else if ("-d".Equals(args[0]))
         {
             //  Console.WriteLine("---------------------------");
             tp = new ThreadPing();
             Service.readAppconfig();
             tp.startPingThread(Service.getAppIPAdderssString());
             MessageBox.Show("----------正在运行不要关闭,也不要点确定-----------------");
             ThreadPing.clear();
         }
     }
 }
Ejemplo n.º 3
0
 protected override void OnStop()
 {
     PingTools.stopApp = true;
     ThreadPing.clear();
 }
Ejemplo n.º 4
0
 public pingService()
 {
     InitializeComponent();
     tp = new ThreadPing();
     tp.startPingThread("192.168.27.253 192.168.27.33");
 }