private void button_send_Click(object sender, RoutedEventArgs e) { if (SendingFilePath != string.Empty) { send.SendTCP(SendingFilePath, StoredConnections.GetConnection(comboBox_connection.SelectedIndex).IP, 12345); } else { MessageBox.Show("Select a file", "Warning"); } }
private void button_delete_Click(object sender, RoutedEventArgs e) { string name = textBox_delete.Text; if (StoredConnections.GetConnection(name) != null) { StoredConnections.RemoveConnection(name); label_delete_msg.Content = "Connection deleted succesfully"; } else { label_delete_msg.Content = "Connection does not exist"; } }
private void Button_Click(object sender, RoutedEventArgs e) { //add new connection string name = textBoxName.Text; string ip = textBoxIP.Text; Connection connection = new Connection(name, ip); if (name == "" || ip == "") { label_succesfull.Content = "Empty input"; } else if (StoredConnections.getConnections().Contains(connection)) { label_succesfull.Content = "Duplicate Connection"; } else if (StoredConnections.GetConnection(name) != null) { //connection exists, we ask the user if he wants to change it if (MessageBox.Show("Connection already exists, change it?", "Connection", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { StoredConnections.GetConnection(name).IP = ip; label_succesfull.Content = "Connection modified"; } } else { label_succesfull.Content = "Connection added succesfully"; StoredConnections.AddConnection(name, ip); } clearInput(); AddTimerEraseLabel(); }