예제 #1
0
파일: MainForm.cs 프로젝트: hpluijm/NetCalc
        private void nextSubnetButt_Click(object sender, System.EventArgs e)
        {
            if (ip == null || ip.getIp() == null || fill)
            {
                return;
            }
            nextNumOfHosts.BackColor = Color.White;

            try
            {
                int hosts = Int32.Parse(nextNumOfHosts.Text);

                IPTool newIp = ip.getNextSubNet(hosts);
                if (newIp == null)
                {
                    //ToManyHosts
                    noticeLabel.Text = "Info stuff: Number of hosts in this network-class not possible!";
                    return;
                }
                ip             = newIp;
                ipAddress.Text = ip.getIp();
            }
            catch (System.FormatException)
            {
                nextNumOfHosts.BackColor = Color.Red;
                return;
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.StackTrace);
                return;
            }

            fillIPCalc();
        }
예제 #2
0
파일: MainForm.cs 프로젝트: hpluijm/NetCalc
        private void prefixComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (ip == null || ip.getIp() == null || fill)
            {
                return;
            }
            if (ip.getNetworkClassPrefix() == -1)
            {
                return;
            }

            int prefix = Int32.Parse((string)prefixComboBox.SelectedItem);

            ip.setNetworkPrefix(prefix);

            fillIPCalc();
        }