namespace MauiControls; public partial class MainPage : ContentPage { public MainPage() => InitializeComponent(); private void OnSubmitClicked(object sender, EventArgs e) { string name = NameEntry.Text?.Trim() ?? ""; string email = EmailEntry.Text?.Trim() ?? ""; string course = CoursePicker.SelectedItem?.ToString() ?? ""; if (string.IsNullOrWhiteSpace(name)) { StatusLabel.Text = "Please enter your name."; return; } if (!email.Contains('@') || !email.Contains('.')) { StatusLabel.Text = "Please enter a valid-looking email."; return; } if (string.IsNullOrEmpty(course)) { StatusLabel.Text = "Please select a course."; return; } if (!ConsentSwitch.IsToggled) { StatusLabel.Text = "Please confirm your registration."; return; } StatusLabel.Text = $"Thanks, {name}! You selected {course}."; } }