private void BtnProcess_Click(object sender, EventArgs e) { lblResult.ForeColor = WarningColour; var result = new RenameResult(); if (!string.IsNullOrEmpty(txtBxDirectory.Text)) { // Modify the file names by removing or replacing the string entered if (chkbxShorten.Checked) { result = FileHelper.RemoveStringsWithinFileNames(txtBxDirectory.Text, txtBxToDelete.Text, txtBxReplacementStr.Text); if (!result.Success) { lblResult.Text = result.Message; return; } } // Add track numbers to file names if (chkbxAddTrackNo.Checked) { result = FileHelper.AddTrackNumsToFileNames(txtBxDirectory.Text); if (!result.Success) { lblResult.Text = result.Message; return; } } if (result.Success) { lblResult.Text = "Files were successfully renamed!"; lblResult.ForeColor = SuccessColour; } } else { lblResult.Text = "Please select directory"; } }