예제 #1
0
        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
            {
            }
        }
예제 #2
0
        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();
                }
            }
        }
예제 #3
0
        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();
                }
            }
        }