コード例 #1
0
 public bool Start(HostControl hostControl)
 {
     Debugger.WriteLine("Web 监控程序,启动成功");
     foreach (var item in Config.Instance.Webs)
     {
         var Monitoring = new Monitoring(item.Name, item.Url);
         Monitoring.StartAsync(this.cancellSource.Token);
     }
     return(true);
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: lynnprosper/GuardDog
        /// <summary>
        /// 开始监控
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStart_Click(object sender, EventArgs e)
        {
            SysConfig             = new Config().NewConfig();
            this.btnStart.Enabled = false;
            this.btnStop.Enabled  = true;
            this.btnSave.Enabled  = false;
            if (this.cancellSource.IsCancellationRequested)
            {
                this.cancellSource = new CancellationTokenSource();
            }

            Task.Run(() =>
            {
                foreach (var item in SysConfig.Webs)
                {
                    var control = new Monitoring(item.Name, item.Url);
                    control.StartAsync(this.cancellSource.Token);
                }
            });
        }