Пример #1
0
 public void Load()
 {
     using (StreamReader reader = new StreamReader(path))
     {
         string s;
         while ((s = reader.ReadLine()) != null)
         {
             string[]      split  = s.Split(' ');
             RoutingRecord record = new RoutingRecord();
             record.SetParameters(split[0], split[1], split[2],
                                  Convert.ToInt32(split[3]));
             table.Add(record);
         }
     }
 }
Пример #2
0
 private void buttonОк_Click(object sender, EventArgs e)
 {
     if (textBoxDest.Text.Equals("") || textBoxMask.Text.Equals("") ||
         textBoxGateway.Text.Equals("") || textBoxMetric.Text.Equals(""))
     {
         MessageBox.Show("Поля заполнены не верно");
     }
     else
     {
         record         = new RoutingRecord();
         record.dest    = textBoxDest.Text;
         record.mask    = textBoxMask.Text;
         record.gateway = textBoxGateway.Text;
         record.metric  = Convert.ToInt32(textBoxMetric.Text);
         DialogResult   = DialogResult.OK;
     }
 }
Пример #3
0
 private void DelRotingRecord_Click(object sender, EventArgs e)
 {
     try
     {
         DataGridViewRow row    = dataGridView1.SelectedRows[0];
         RoutingRecord   record = new RoutingRecord();
         record.SetParameters((string)row.Cells["dest"].Value,
                              (string)row.Cells["mask"].Value,
                              (string)row.Cells["gateway"].Value,
                              Convert.ToInt32(row.Cells["metric"].Value));
         router.DeleteRoutingRecord(record);
         dataGridView1.Rows.Remove(row);
     }
     catch (ArgumentOutOfRangeException)
     {
         MessageBox.Show("Выберите строку для удаления");
     }
 }
 public void DeleteRoutingRecord(RoutingRecord record)
 {
     table.DelRecord(record);
 }
 public void AddRoutingRecord(RoutingRecord record)
 {
     table.AddRecord(record);
 }
Пример #6
0
 public void DelRecord(RoutingRecord record)
 {
     table.Remove(record);
 }