/// <summary> /// /// Click trigger function for the begin button. /// This will create a new FeedbackForm.cs instance /// from the starting position of 0. /// /// </summary> private void Button_Begin_Click(object sender, EventArgs e) { Hide(); FeedbackForm instance_FeedbackForm = NextForm(Direction.Current, 0); instance_FeedbackForm.Show(); }
/// <summary> /// /// Click trigger function for preview button. /// This will collect the details of the selected /// applicant and start the feedback form with this /// details. /// /// </summary> private void Button_Preview_Click(object sender, EventArgs e) { string applicantLookup = CheckedListBox_FeedbackList.Items[currentApplicant].ToString(); applicantDetails = applicantLookup.Split(new[] { " " }, StringSplitOptions.None); // Stop preview if no applicants have been selected. if (applicantDetails == null) { DisplayError("Select an applicant to preview"); return; } else { HideError(); } // Don't preview if the files can't be opened. if (FilesInUse()) { return; } Hide(); FeedbackForm instance_FeedbackForm = new FeedbackForm(applicantDetails[2], // Name applicantDetails[0], // Type applicantDetails[3], // Email applicantDetails[1], // Job currentApplicant); // List position instance_FeedbackForm.Show(); }
/// <summary> /// /// Click trigger function for the next button. /// This will save the feedback and comments, then /// go to the next applicant in the list or if at /// the end of the list, will go to the preview form. /// If in preview mode, this will save the feedback /// and return to the preview form. /// /// </summary> private void Button_Next_Click(object sender, EventArgs e) { if (currentMode == Mode.Feedback) { // save template if (RichTextBox_Feedback.Text.Length > 0) { using (StreamWriter feedbackFile = new StreamWriter(Recruiter.GetInstance().Name + Applicant.applicants[currentPosition].AfullName + ".rtf")) { feedbackFile.WriteLine(RichTextBox_Feedback.Text); } } // save comments if (RichTextBox_Comments.Text.Length > 0) { using (StreamWriter commentsFile = new StreamWriter(Recruiter.GetInstance().Name + Applicant.applicants[currentPosition].AfullName + "-comments.rtf")) { commentsFile.WriteLine(RichTextBox_Comments.Text); } } if (currentPosition < Template.templatesForApplicants.Count - 1) { Hide(); FeedbackForm instance_FeedbackForm = NextForm(Direction.Forward, currentPosition); instance_FeedbackForm.Show(); } else if (currentPosition >= Template.templatesForApplicants.Count - 1) { Hide(); PreviewForm instance_PreviewForm = new PreviewForm(); instance_PreviewForm.Show(); } } else if (currentMode == Mode.Preview) { if (RichTextBox_Feedback.Text.Length > 0) { using (StreamWriter feedbackFile = new StreamWriter(Recruiter.GetInstance().Name + PreviewModeApplicantName + ".rtf")) { feedbackFile.WriteLine(RichTextBox_Feedback.Text); } } if (RichTextBox_Comments.Text.Length > 0) { using (StreamWriter commentsFile = new StreamWriter(Recruiter.GetInstance().Name + PreviewModeApplicantName + "-comments.rtf")) { commentsFile.WriteLine(RichTextBox_Comments.Text); } } Hide(); PreviewForm instance_PreviewForm = new PreviewForm(); instance_PreviewForm.Show(); } }
/// <summary> /// /// Click trigger function for back button. /// This will return to the previous applicant /// feedback, or if at the start of the list, /// return back to the total applicant list. /// If in preview mode, this will bring the user /// back to the preview form. /// /// </summary> private void Button_Back_Click(object sender, EventArgs e) { if (currentMode == Mode.Feedback) { if (currentPosition > 0) { Hide(); FeedbackForm instance_FeedbackForm = NextForm(Direction.Backward, currentPosition); instance_FeedbackForm.Show(); } else if (currentPosition == 0) { Hide(); ConfirmApplicantForm instance_ConfirmApplicantForm = new ConfirmApplicantForm(false); instance_ConfirmApplicantForm.Show(); } } else if (currentMode == Mode.Preview) { Hide(); PreviewForm instance_PreviewForm = new PreviewForm(); instance_PreviewForm.Show(); } }