private void BtnSendFolder_Click(object sender, EventArgs e) { string source, destination; source = txtSourceFolder.Text; destination = txtDestinatioinFolder.Text; var id = GetID(); if (string.IsNullOrEmpty(source)) { throw new Exception("Source cannot be empty."); } if (string.IsNullOrEmpty(destination)) { throw new Exception("Destination cannot be empty."); } try { _listener.SendFolder(id, source, destination, false); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }