Example #1
0
        /// <summary>
        /// Trata a operação de Set de um objeto da MIB sobre um Host
        /// </summary>
        private void setToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!ValidaHostSelecionado())
            {
                return;
            }

            using (var setValue = new MIBObjectSetForm())
            {
                var result = setValue.ShowDialog(this);
                switch (result)
                {
                case DialogResult.OK:
                    try
                    {
                        var req = new SNMPCommunications(SelectedHost, SelectedMibObject);
                        req.Send(setValue.ConvertedValue());
                        SNMPCommunications.Add(req);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    break;

                case DialogResult.Cancel:
                    break;

                default:
                    break;
                }
            }
        }
Example #2
0
        /// <summary>
        /// Trata a operação de Get de um objeto da MIB sobre um Host
        /// </summary>
        private void getToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!ValidaHostSelecionado())
            {
                return;
            }

            var req = new SNMPCommunications(SelectedHost, SelectedMibObject);

            try
            {
                req.Send();
                SNMPCommunications.Add(req);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }