Example #1
0
        private void AddLoadedHost(object hostNode)
        {
            try
            {
                HostPinger hp = new HostPinger((XmlNode)hostNode);
                hp.Logger          = DefaultLogger.Instance;
                hp.OnPing         += new OnPingDelegate(OnHostPing);
                hp.OnStopPinging  += new OnHostPingerCommandDelegate(hp_OnStopPinging);
                hp.OnStartPinging += new OnHostPingerCommandDelegate(hp_OnStartPinging);

                HostDataSeries series = new HostDataSeries(this, hp);
                series.LoadSettings((XmlNode)hostNode);

                lock (_hosts)
                {
                    _hosts.Add(hp);
                    _dataSeries.Add(hp, series);
                    //	_graphManager.RegisterSeries(series);
                }

                if (Options.Instance.StartPingingOnProgramStart)
                {
                    hp.Start();
                }
            }
            catch (Exception ex)
            {
                if (Options.Instance.ShowErrorMessages)
                {
                    MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #2
0
        public void UnregisterSeries(HostDataSeries series)
        {
            string prefix = series.Host.ID.ToString() + ":";

            lock (_regSeries)
            {
                foreach (DataSeriesNameParser s in series.SeriesNames)
                {
                    string id = prefix + (int)s.Source;
                    _regSeries.Remove(id);
                    _regSeriesIDs.Remove(s.Series);
                }
            }
        }
Example #3
0
        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();
                }
            }
        }
Example #4
0
        private void _cmbHost_SelectedIndexChanged(object sender, EventArgs e)
        {
            _cmbSeries.Items.Clear();

            if (_cmbHost.SelectedItem != null)
            {
                HostDataSeries host = (HostDataSeries)_cmbHost.SelectedItem;
                foreach (DataSeriesNameParser s in host.SeriesNames)
                {
                    _cmbSeries.Items.Add(s);
                }
            }

            if (_cmbSeries.Items.Count > 0)
            {
                _cmbSeries.SelectedIndex = 0;
            }
        }