Inheritance: System.Windows.Forms.Form
Ejemplo n.º 1
0
        private void button9_Click(object sender, EventArgs e)
        {
            ushort metric  = ushort.Parse(listView1.SelectedItems[0].SubItems[5].Text);
            int    ifIndex = int.Parse(Regex.Replace(listView1.SelectedItems[0].SubItems[3].Text, @"^(\d+) .*$", "$1"));

            if (Environment.OSVersion.Version.CompareTo(new Version("6.0")) > -1)
            {
                if (ifIndex != 1)
                {
                    metric -= Global.NetworkInterfaces.Values.Where((i) => i.Index == ifIndex).FirstOrDefault().InterfaceMetric;
                }
                else
                {
                    metric -= NetworkInterface.Loopback.InterfaceMetric;
                }
            }
            SaveRouteForm form = new SaveRouteForm(comboBox1.SelectedIndex == 0 ? 4 : 6,
                                                   listView1.SelectedItems[0].SubItems[0].Text,
                                                   listView1.SelectedItems[0].SubItems[1].Text,
                                                   listView1.SelectedItems[0].SubItems[2].Text,
                                                   ifIndex.ToString(),
                                                   metric.ToString());

            form.ShowDialog();
        }
Ejemplo n.º 2
0
 private void button9_Click(object sender, EventArgs e)
 {
     ushort metric = ushort.Parse(listView1.SelectedItems[0].SubItems[5].Text);
     int ifIndex = int.Parse(Regex.Replace(listView1.SelectedItems[0].SubItems[3].Text, @"^(\d+) .*$", "$1"));
     if (Environment.OSVersion.Version.CompareTo(new Version("6.0")) > -1)
         if (ifIndex != 1)
             metric -= Global.NetworkInterfaces.Values.Where((i) => i.Index == ifIndex).FirstOrDefault().InterfaceMetric;
         else
             metric -= NetworkInterface.Loopback.InterfaceMetric;
     SaveRouteForm form = new SaveRouteForm(comboBox1.SelectedIndex == 0 ? 4 : 6,
         listView1.SelectedItems[0].SubItems[0].Text,
         listView1.SelectedItems[0].SubItems[1].Text,
         listView1.SelectedItems[0].SubItems[2].Text,
         ifIndex.ToString(),
         metric.ToString());
     form.ShowDialog();
 }