private void buttonAddTargets_Click(object sender, EventArgs e) { Host hostSayTo = null; Host hostThat = null; Host hostIs = null; foreach (Host host in HostManager.Instance.Hosts) { if (host.Equals(comboBoxSayTo.SelectedItem)) { hostSayTo = host; } if (host.Equals(comboBoxThat.SelectedItem)) { hostThat = host; } if (host.Equals(comboBoxIs.SelectedItem)) { hostIs = host; } } if (hostSayTo == null || hostThat == null || hostIs == null) { return; } ArpPoisoning arp_poisoning = new ArpPoisoning(hostSayTo, hostThat, hostIs); arp_poisoning.StatusChanged += UpdateStatut; _list_arp_poisonning.Add(arp_poisoning); UpdateView(); }
private void RemoveSelectedItem() { int indice = SelectedIndice; if (indice == -1) { return; } ArpPoisoning arp_poisoning = SelectedItem; arp_poisoning.StatusChanged -= UpdateStatut; arp_poisoning.Stop(); _list_arp_poisonning.RemoveAt(indice); UpdateView(); UpdateSelection(); }