private void AddNetwork_Click(object sender, RoutedEventArgs e) { Network newNetwork = new Network(NetworkTB.Text); bool bSuccess = st.SaveNetwork(newNetwork); if (bSuccess) { Networks.Add(newNetwork); NetworkLB.Items.Refresh(); NetworkTB.Clear(); } else { } }
private void RemoveNetwork_Click(object sender, RoutedEventArgs e) { Network currentNetwork = NetworkLB.SelectedItem as Network; bool bSuccess = false; if (currentNetwork is null) { MessageBox.Show("Please select a network to be deleted."); } else { bSuccess = st.DeleteNetwork(currentNetwork); if (bSuccess) { MessageBox.Show("The network: " + currentNetwork.NetworkName + " has been deleted from the network list"); Networks.Remove(currentNetwork); NetworkLB.Items.Refresh(); NetworkTB.Clear(); } } }
private void UpdateNetwork_Click(object sender, RoutedEventArgs e) { Network currentNetwork = NetworkLB.SelectedItem as Network; bool bSuccess = false; if (currentNetwork is null) { MessageBox.Show("Please select a network to be deleted."); } else { bSuccess = st.UpdateNetwork(currentNetwork, NetworkTB.Text); if (bSuccess) { MessageBox.Show("The network: " + currentNetwork.NetworkName + " has been updated to: " + NetworkTB.Text); Networks.Where(name => name.NetworkName == currentNetwork.NetworkName).First().NetworkName = NetworkTB.Text; NetworkLB.Items.Refresh(); NetworkTB.Clear(); } } }