예제 #1
0
파일: PingForm.cs 프로젝트: hjohneny/PingU
 private void _tbHostOptions_Click(object sender, EventArgs e)
 {
     if (_selectedPinger != null)
     {
         HostOptions dlg = new HostOptions();
         dlg.ShowDialog(this, _selectedPinger);
     }
 }
예제 #2
0
파일: PingForm.cs 프로젝트: hjohneny/PingU
        public void AddNewHost(HostPinger host)
        {
            HostOptions dlg = new HostOptions();

            if (dlg.ShowDialog(this, host) == DialogResult.OK)
            {
                bool exists = false;
                lock (_hosts)
                {
                    foreach (HostPinger hp in _hosts)
                    {
                        if (hp.HostIP != null && hp.HostIP == dlg.Host.HostIP)
                        {
                            exists = true;
                            break;
                        }
                    }
                }

                if (exists)
                {
                    MessageBox.Show("Host already exists.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                dlg.Host.Logger          = DefaultLogger.Instance;
                dlg.Host.OnPing         += new OnPingDelegate(OnHostPing);
                dlg.Host.OnStopPinging  += new OnHostPingerCommandDelegate(hp_OnStopPinging);
                dlg.Host.OnStartPinging += new OnHostPingerCommandDelegate(hp_OnStartPinging);

                lock (_hosts)
                {
                    _hosts.Add(dlg.Host);

                    HostDataSeries series = new HostDataSeries(this, dlg.Host);
                    _dataSeries.Add(dlg.Host, series);
                    //	_graphManager.RegisterSeries(series);
                }

                _hostListChanged = true;

                if (MessageBox.Show("Start pinging of the host?", "Start", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    dlg.Host.Start();
                }
            }
        }
예제 #3
0
        private void _tbAddNewHost_Click(object sender, EventArgs e)
        {
            HostOptions dlg = new HostOptions();

            if (dlg.ShowDialog(this, null) == DialogResult.OK)
            {
                foreach (HostPinger hp in _hosts)
                {
                    if (hp.HostIP == dlg.Host.HostIP)
                    {
                        MessageBox.Show("Host already exists.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                _hosts.Add(dlg.Host);
                dlg.Host.OnPing += new PingDelegate(OnHostPing);
            }
        }