コード例 #1
0
        private void resolveBtn_Click(object sender, EventArgs e)    //TODO: validate domain name(or truncate)
        {
            if (string.IsNullOrEmpty(domainNameTxtBox.Text))
            {
                MessageBox.Show(this, "Domain name can't be empty");
                return;
            }

            var ips = _nameResolver.GetHostIpByName(domainNameTxtBox.Text);

            if (ips == null)
            {
                MessageBox.Show(this, $"Domain {domainNameTxtBox.Text} could not be resolved");
                return;
            }

            foreach (var ip in ips)
            {
                ipsListBox.Items.Add(ip);
            }
        }