Exemplo n.º 1
0
 public DHCPServerResurrector(DHCPServerConfiguration config, EventLog eventLog)
 {
     m_Lock       = new object();
     m_Disposed   = false;
     m_Config     = config;
     m_EventLog   = eventLog;
     m_RetryTimer = new Timer(new TimerCallback(Resurrect));
     Resurrect(null);
 }
Exemplo n.º 2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            DHCPServerConfiguration result = EditConfiguration(-1, new DHCPServerConfiguration());

            if (result != null)
            {
                m_ConfigurationList.Add(result);
                SelectRow(m_ConfigurationList.Count - 1);
                UpdateButtonStatus();
            }
        }
Exemplo n.º 3
0
 private bool ConfigurationCollides(int index, DHCPServerConfiguration config)
 {
     for (int t = 0; t < m_ConfigurationList.Count; t++)
     {
         if (t != index && config.Address == m_ConfigurationList[t].Address)
         {
             System.Diagnostics.Debug.WriteLine(string.Format("item {0} collides with {1}", t, index));
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 4
0
 private void EditConfiguration(int index)
 {
     if (index >= 0 && index < m_ConfigurationList.Count)
     {
         DHCPServerConfiguration result = EditConfiguration(index, m_ConfigurationList[index]);
         if (result != null)
         {
             m_ConfigurationList.Insert(index, result);
             m_ConfigurationList.RemoveAt(index + 1);
         }
     }
 }
Exemplo n.º 5
0
        private DHCPServerConfiguration EditConfiguration(int index, DHCPServerConfiguration input)
        {
            FormSettings f = new FormSettings();

            f.Configuration = input;

            DialogResult dialogResult = f.ShowDialog(this);

            while (dialogResult == DialogResult.OK && ConfigurationCollides(index, f.Configuration))
            {
                MessageBox.Show(string.Format("There already is a DHCP server configuration for address {0}.\r\nPlease select another address.", f.Configuration.Address), "Validation error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                dialogResult = f.ShowDialog(this);
            }

            return(dialogResult == DialogResult.OK ? f.Configuration : null);
        }