/// <summary> /// Handles the Click event of the FindButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void FindButton_Click(object sender, EventArgs e) { // Check that we have a folder to search if (string.IsNullOrWhiteSpace(ContainingFileText.Text)) { MessageBox.Show("Please specify a source control folder to search", "Find Changeset By Comment", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } // Check that we have a valid regular expression if (useRegularExpressions.Checked && !string.IsNullOrWhiteSpace(ContainingCommentText.Text)) { try { Regex rx = new Regex(ContainingCommentText.Text); } catch (ArgumentException) { MessageBox.Show("Please specify a valid regular expression", "Find Changeset By Comment", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } searchCriteria.SearchFile = ContainingFileText.Text.Trim(); searchCriteria.SearchUser = ByUserText.Text; searchCriteria.FromDateVersion = FromDatePicker.Checked ? new DateVersionSpec(FromDatePicker.Value) : null; searchCriteria.ToDateVersion = ToDatePicker.Checked ? new DateVersionSpec(ToDatePicker.Value) : null; searchCriteria.SearchComment = ContainingCommentText.Text; searchCriteria.UseRegex = useRegularExpressions.Checked; ResultsList.Items.Clear(); FilesList.Items.Clear(); FindButton.Enabled = false; FindChangesetsWorker.RunWorkerAsync(); }
/// <summary> /// Handles the Click event of the CancelButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void CancelFindButton_Click(object sender, EventArgs e) { if (FindChangesetsWorker.IsBusy) { FindChangesetsWorker.CancelAsync(); } }