Esempio n. 1
0
        private void LvHosts_MouseDoubleClick(object sender, MouseEventArgs e) // do not use mouse event args as we pass null..
        {
            if (lvHosts.SelectedItems.Count == 1)
            {
                var entry = lvHosts.SelectedItems[0].Tag as HostEntry;

                using (var dlg = new AddEditHostDlg(entry, false))
                {
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        _client.SendRemoveDomain(entry.Name);
                        _client.SendAddDomain(dlg.DomainName, dlg.IPAddress, dlg.Description, dlg.HiddenDomain);
                    }
                }
            }
        }
Esempio n. 2
0
 private void addNewHostToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var dlg = new AddEditHostDlg())
     {
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             if (dlg.LocalDomain)
             {
                 HostsDatabase.Add(true, dlg.DomainName, dlg.IPAddress, dlg.Description, dlg.HiddenDomain);
                 HostsDatabase.Save();
                 EventCallbackSystem.InvokeCallback("HostsListUpdated", true);
             }
             else
             {
                 _client.SendAddDomain(dlg.DomainName, dlg.IPAddress, dlg.Description, dlg.HiddenDomain);
             }
         }
     }
 }
Esempio n. 3
0
        private void LvLocalHosts_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (lvLocalHosts.SelectedItems.Count == 1)
            {
                var entry = lvLocalHosts.SelectedItems[0].Tag as HostEntry;

                using (var dlg = new AddEditHostDlg(entry, true))
                {
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        HostsDatabase.Remove(true, entry.Name);
                        HostsDatabase.Add(true, dlg.DomainName, dlg.IPAddress, dlg.Description, dlg.HiddenDomain);
                        HostsDatabase.Save();

                        EventCallbackSystem.InvokeCallback("HostsListUpdated", true);
                    }
                }
            }
        }