private void btnCancel_Click(object sender, EventArgs e) { if (transferFinished) { Close(); } else { fileTransfer.Decline(); btnCancel.Visible = false; Close(); } }